MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 25th, 2013, 11:31 AM
colpaarm's Avatar
colpaarm colpaarm is offline
300lb Bench!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2001
Location: New York
Posts: 2,343 colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 10 h 50 m 4 sec
Reputation Power: 60
Internal server error during inserts only

Hey guys. I have a little weird issue here. I have a website and pages load just fine. However, whenever someone tries to make any inserts, my pages hang and I eventually get an internal server error. This started just this morning and I haven't changed anything from yesterday until today.

I'm on a VPS. I restarted mysql to no avail. I even tried restarting apache just for S&Gs. The load on the site looks fine. All reads work just fine. As a matter of fact, as I write this I have 7 people on my site solving chess puzzles. Again, those are only reads. They make a puzzle guess and an ajax calls does a select to see if their gusess was correct. But all of my users who are trying to play games? The inserts SOMETIMES happen, but in most cases, the page doesn't return even when it does work. I looked in the apache error logs and didn't see anything that would tip me off as to what's going on and my hosting company is moving REAL SLOW.

Anyway, considering this is a basic code base I've had for years and I haven't changed anything from yesterday til today, have any of you guys heard of anything like this (reads no problem, writes VERY difficult)? I don't get that much traffic. Maybe 1500 page views a day. 2000 tops. I probably have no more than 15 people on my site at any one time. Anyway, thanks for any help you can give solving this mystery.
__________________
Correspondence chess
nothingbutchess.com

Reply With Quote
  #2  
Old February 25th, 2013, 12:01 PM
colpaarm's Avatar
colpaarm colpaarm is offline
300lb Bench!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2001
Location: New York
Posts: 2,343 colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 10 h 50 m 4 sec
Reputation Power: 60
Just to give a little more information, the slowness is happening when I attempt to insert into a longtext field. I create an object of the game, serialize it, then insert it into the database. I've been doing this for years.

Reply With Quote
  #3  
Old February 25th, 2013, 12:50 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,723 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 7 h 52 m 46 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Drive problems?

Make a script/SQL that tries to insert some longtext data into a test table, see if that causes any problems.

Reply With Quote
  #4  
Old February 25th, 2013, 03:13 PM
colpaarm's Avatar
colpaarm colpaarm is offline
300lb Bench!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2001
Location: New York
Posts: 2,343 colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 10 h 50 m 4 sec
Reputation Power: 60
Ok, this looks like it's not my issue. Looks to be a hosting issue. Annoying when you have users on your site and this happens. Makes you look bad, but what are you going to do? Thanks guys.

Reply With Quote
  #5  
Old February 25th, 2013, 05:36 PM
colpaarm's Avatar
colpaarm colpaarm is offline
300lb Bench!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2001
Location: New York
Posts: 2,343 colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 10 h 50 m 4 sec
Reputation Power: 60
Ok, the problem still persists. I save all errors to the database, so I checked to see if there was anything. Sure enough, the insert that I thought was causing the problem is throwing the following error:

Cannot insert into...(huge sql statement)

because: Lock wait timeout exceeded; try restarting transaction

This huge statement really just has two columns, one of them being a longtext field. Bottom line, it's a serialized object that I store as a longtext. I've been doing this for years without incident. Have I some how created a lock that just needs to be released? Again, the field is longtext, so I don't see the size of what's being updated (48kb worth of stuff, I just checked) being an issue. Again, I've been doing this same insert for years with no issue. Any thoughts?

Reply With Quote
  #6  
Old February 25th, 2013, 06:02 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,723 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 7 h 52 m 46 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Some query somewhere is locking the table. It's probably running for a long time; try a SHOW FULL PROCESSLIST, scan down the queries returned, and see what's running. It also includes the running time.

Once you identify the query you can figure out why it's taking so long. Typically it's a SELECT query with really bad performance.

Reply With Quote
  #7  
Old February 25th, 2013, 06:31 PM
colpaarm's Avatar
colpaarm colpaarm is offline
300lb Bench!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2001
Location: New York
Posts: 2,343 colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 10 h 50 m 4 sec
Reputation Power: 60
I get back

Code:
mysql> SHOW FULL PROCESSLIST;
+------+------+-----------+------+---------+------+-------+-----------------------+
| Id   | User | Host      | db   | Command | Time | State | Info                  |
+------+------+-----------+------+---------+------+-------+-----------------------+
| 1699 | root | localhost | (my database name)  | Query   |    0 | NULL  | SHOW FULL PROCESSLIST |
+------+------+-----------+------+---------+------+-------+-----------------------+
1 row in set (0.00 sec)


And again, considering this is the code that's been running for years and I didn't make any changes yesterday and it was running fine yesterday, only to wake up this morning and see this issue (under at the time, light load)...I'm a little stumped here.

Reply With Quote
  #8  
Old February 25th, 2013, 06:52 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,723 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 7 h 52 m 46 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Did you do that during a page hang?

Reply With Quote
  #9  
Old February 25th, 2013, 08:56 PM
colpaarm's Avatar
colpaarm colpaarm is offline
300lb Bench!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2001
Location: New York
Posts: 2,343 colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 10 h 50 m 4 sec
Reputation Power: 60
Ok, I did it during a simple delete statement involving the two tables that seem to be the ones where I'm experiencing most of my issues (although there have been others) and received the following:

Code:
mysql> SHOW FULL PROCESSLIST;
+-------+------+-----------+------+---------+------+-------+-----------------------+
| Id    | User | Host      | db   | Command | Time | State | Info                  |
+-------+------+-----------+------+---------+------+-------+-----------------------+
| 12015 | root | localhost | nbc  | Query   |    0 | NULL  | SHOW FULL PROCESSLIST |
| 12076 | root | localhost | nbc  | Sleep   |   (number) |       | NULL     


Where (number) went from 3 and slowly crept it's way up to 61. I kept running the query as it hung. At one point, three processes showed up, with the third one being

12145 | root | localhost | nbc | Sleep | 0 | | NULL

but that one went away the moment I ran the command again. After about 20 seconds or so, it FINALLY did the delete. I mean, we're talking to simple delete statements. Now again, one of the deletes has a field that has roughly 48k worth of data in it, but I've been doing this literally for years with nary a hitch. Considering these same commands run blazing fast in the mysql client, I'm beginning to think that apache is somehow screwed. However, I've restarted this before to no avail. I'm unfortunately stumped here.

Reply With Quote
  #10  
Old February 25th, 2013, 09:22 PM
colpaarm's Avatar
colpaarm colpaarm is offline
300lb Bench!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2001
Location: New York
Posts: 2,343 colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level)colpaarm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 10 h 50 m 4 sec
Reputation Power: 60
Ok, I've isolated the error and it has nothing to do with the mysql database, my code nor the apache server. It appears that the problem is with the sendmail server.

I created a test php page with inserts, updates and deletes of this large data and had no issues at all. I finally realized that the only thing that every failed operation had in common was that after every operation, it would send out an email. "Hey, it's your turn to move." "Hey, you lost the game." Took those out and everything is running fine. Now...to contact my hosting provider and together figure out what to do here. I guess restarting sendmail would be the first step. Obviously this is no longer a mysql issue. Thanks a ton, requinix.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Internal server error during inserts only

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap