lundi 28 septembre 2015

Laravel SQL Chunk gives -902: Error reading data from the connection

I'm currently querying a huge Firebird (v2.5) table (with millions of rows) in order to perform some row-level operations. To achieve that, the code is using chunking from Laravel 5.1, somewhat like this:

DB::connection('USER_DB')
    ->table($table->name)
    ->chunk(min(5000, floor(65500/count($table->fields))), function($data) {
        // running code and saving
    });

For some reason, I keep receiving the following error:

SQLSTATE[HY000]: General error: -902 Error reading data from the connection.

I've already tried changing chunk size, and different codes, but the error still appears. Sometime it happens at the beginning of the table, and sometimes after parsing several hundred-thousands or even millions rows. The thing is that I need to parse only the rows in this transaction (so I can't stop and reopen the script).

Tested for memory on the server (running on different place than the database), and it is not using nearly anything of it.

While writing this, I rechecked the Firebird log and found the following entry:

INET/inet_error: read errno = 10054

As far as I could find, this isn't actually a Firebird problem, but a winsock reset error, is that correct? If so, how could I prevent this from happening during the chunk query? And how can I check if that is a problem with windows or the firewall?

Update I

Digging on the firebird2.5.log on the PHP server, found this errors:

INET/inet_error: send errno = 104

REMOTE INTERFACE/gds__detach: Unsuccesful detach from database.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire