Strange MySQL error "Empty row packet body" when using mysql_fetch_object (PHP 5.3.3)

aws the mysql server is running with the --read-only option
mysql read-only
how to change read only variable in mysql
error 1290 mysql
mysql super read-only
error code: 1290 mysql mac
mysql table read only
mysql> create temporary table read_only

I get a really strange, pointless and totally random error when I fetch rows from a resource (query) using PHP.

My development machine is a Windows XP SP3 with Apache 2.2 while MySQL runs on a virtual machine, using ubuntu 10.04, with 768mb of ram, 100GB of HDD and 4 logic cores (Intel q6600). However this problem is not related to PHP on windows because I get the same error when I run the code on the database machine.

I'm using mysql extension (not mysqli or mysqlnd), but looking around I founded a patch regarding this error related to mysqlnd extension, so, probably, I should try.

The main problem is that when I execute this query (a really big query with a couple of derived table and more than 20 joins) and process results fast and all goes well, but when my code spent around 15/20 seconds to process a block of rows (I need build an object from a block of rows linked in a really particular way between them, I can't change this, database isn't mine, and make some PDF from this object) after a while (random time) I get this error "Empty row packet body".

I use unbuffered queries to reduce memory consumption (if I enable buffering I get around 260MB of used memory) but this shouldn't be the problem.

I ran into the same error. I was using PDO, but it should basically be the same thing.

Are you operating on a MyISAM table? If so, the problem is probably related to the locking model this Engine uses: it locks the whole table, for reading with a shared lock, for writing with an exclusive lock.

This is what I was trying to do: Read a large result set unbuffered, and update some of the rows in the same table. Since you can't issue a statement on the same connection while it holds an unbuffered result set, I tried using another connection for the updates. Reading went well until the first update, at which point the script stalled for about a minute, then I got the "Empty row packet body" error.

You see, when reading unbuffered, the shared lock is kept until the whole result set has been read or the cursor is being closed. During that time, the table is locked with a shared lock, so other connections can obtain shared locks on the table (in other words, read from it), but exclusive locks (for writing) will have to wait. If this happens within the same script, it will deadlock.

Now, to prevent endless deadlocking, MySQL will forcibly release your shared lock after a while (IIRC this is affected by the value of table_lock_wait_timeout), dumping your result set and allowing the writing statement with the waiting exclusive lock to get its turn.

So, while in my case it was the same script that did this and therefore stalled until the timeout expired, it might also be that some other script is attempting a write operation on the table with the same effect, which is probably what happened in your case.

What solved the problem for me was changing the table type to InnoDB, since that Engine uses row-level instead of table-level locks. However, since you say the database is not yours, this might not be possible for you.

Strange mysql error:Out of range value for column Need Help, Hi, I am facing a strange error where in when I am trying to save a file with save_file function in frappe I am getting the out of range value for  I tested these queries using JAVA and connecting directly to the same databases and all worked ok, so I think this may be some weird problem in PHP communicating with MySQL (I tested this using both PHP 5 and PHP 4)

Having this error a while a ago, I've fixed it by increasing the value of

net_read_timeout = 360
net_write_timeout = 360

While a connection is open on write, waiting for another query to end to continue inserting, this times out, giving an empty row packet. I'm working on very large dataset, used value are over 360. Your value will depend on your use case.

MySQL error strange - Server Discussion, My server was running fine, and gave this error from nowhere, can you help me? [ERROR] [MySQL] An error happens on MySQL for query  SOLVED MySQL Updates acting strange after updating my.cnf: CSV Import Sheets - Data Chops Off At Strange Characters: Need Urgent Help, I'm in strange situation: Strange and Sudden loss of remote connection ability: strange phpmyadmin behaviour

user589182's answer is spot on. I am doing essentially the same thing: Read a large result set unbuffered, and update some of the rows in the same table, from the same PHP script. I got the exact same error message after approx. 2500 UPDATEs. Problem solved after switching from MyISAM to InnoDB.

MySQL Stored Procedure Programming: Building High-Performance Web , stored program compilation errors, the error message does not directly identify the absence of the SET statement, so when checking your program for strange  Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up. Sign up to join this community

I got the same error, and I was also reading a large result set unbuffered while updating the rows of the same table.

Instead of switching to InnoDB, a better solution might be to create a temporary table containing only the primary key of the original table. Then, loop through that temporary table while selecting and updating one row at a time from the original table. You will have to use two separate MySQL connections in order to do this, otherwise you will get a "Commands out of sync" error.

You might need to lock the original table to prevent anyone else from reading/writing to it while this is happening.

SOLVED, I have been observing for a long time this error that consumes almost all my CPU: Code: /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql  Below is part of a form I'm working on. I have two questions about capturing MySQL insertion errors. 1) I have an odd failure to trigger an error message. In the

I was on InnoDB and never had this type of problem until I switched coding environment(literally, like the location). So, if you changed your wireless connection, that may be the problem especially if its a public place.

MySQL 5.6 Release Notes :: Changes in MySQL 5.6.5 , The host cache has additional counters to track errors that do apply to specific IP InnoDB: Ignoring strange row from mysql.innodb_index_stats WHERE . Slave A, MySQL 5.5.38, has been replicating all tables in all databases from this master just fine for a long while, producing no errors of any kind. IO_THREAD was paused on slave A. Value of Relay_Master_Log_File was confirmed to match that of Master_Log_File and value of Exec_Master_Log_Pos was confirmed to match that of Read_Master_Log_Pos .

MySQL Reference Manual: Documentation from the Source, If you get some strange error during this stage , check that you really have libtool installed ! shell > cd mysql shell > bk - r edit shell > aclocal ; autoheader  <t>Today I had very strange problem with MySql on my VPS ( ubuntu 64 9.10 ) Server stoped CPU usage 120% and Disk IO 35k Only shutdown helped. After rebooting everything was ok.

PHP and MySQL for Dynamic Web Sites, Fourth Edition: Visual , This may look strange when viewing the actual files on the server, but is not a problem If the query did not affect one row, there's probably some MySQL error​  I have copied the /var/lib/mysql/mydbname db to a new machine from a crashed server (booted using a live cd) but now I cannot access the tables within the db All the tables only have a .frm extension, so I am assuming they are InnoDB. They appear in a SHOW TABLES statement, but I cannot SELECT from them. REPAIR / OPTIMIZE / ANALYZE all give;

Laravel post request url parameter taking as mysql column. Strange , Hi, I am getting this bellow error on post request SQLSTATE[42S22]: Column not found: 1054 Unknown column '/settings/app_settings_update'  Error: Ignoring Strange Row From mysql.innodb_index_stats (Doc ID 1611997.1) Last updated on APRIL 06, 2020. Applies to: MySQL Server - Version 5.6 and later

Comments
  • Can you show some code? What are your command timeouts set to?
  • the problem isin't related to timeouts or memory limit because i've disabled the first and set to a very very very high value the second
  • Where I work we develop using a local Apache 2.2/PHP 5.3.3 on a Windows XP Pro SP3 too, and a shared test database server, and we get this error all the time. HOWEVER, the shared Apache/Linux setup, whose versions I'm not aware of, do not give this error, so this might suggest the problem might be caused by Apache version or something like that instead of database configuration or usage!
  • @DanieleSalvatoreAlbano i have the exact problem. i tired many thing. did you finally solved this?
  • The error message is fairly generic and the problem itself is triggered by the died network connection, that may happen for many different reason. Are you using unbuffered queries? Does the query take a long time to execute if you use a mysql client to test it? It's very likely that you will need to tune the timeouts (globally in mysql or per session if yiu can't manage the mysql instance you are using)
  • Initially table type was myisam, later i switched to innodb to do a test but the problem remained. However actually i didn't get it anymore, i must hyper-stress the server to get it
  • This didn't work for me, even when the table is copied and I am 100% sure nobody was writing to it.
  • Note that internal temporary tables (created by MySQL for some queries, see EXPLAIN) will use MyISAM in MySQL 5.6: On-disk temporary tables are managed by the MyISAM storage engine Hence you might end up with this error while query seems to only involve InnoDB tables (but actually requires a temporary table that MySQL 5.6 will create using MyISAM)
  • Where to put these lines, in which block?
  • In your mysql configuration, usually called my.conf, in the block mysqld
  • Perfect, I wasn't sure about a block. Thanks!