Open indreka opened 7 years ago
Sounds like the queue plugin has some poor error handling. I personally suggest that you use workers to write to a database, and just use sync jobs, but if you must use the queue module, this should be relatively straight forward to fix.
Had a case where the backing mysql server had max_allowed_packet set to 4MB by default and then a bigger packet (4.2MB) was sent to gearman server, which tried to add it to mysql queue. Mysql official documentation states that if the packet is too large, the connection gets closed entirely. https://dev.mysql.com/doc/refman/5.7/en/packet-too-large.html
For some reason the gearman server did not write anything useful to the log, used gdb to get the backtrace, which revealed that data_size passed to _mysql_queue_add was over 4MB. Due to some special circumstances, I could not correctly debug, but my suspicion is that in mysql plugin the combination of "mysql_stmt_errno(queue->add_stmt) == CR_SERVER_LOST" being true and queue->prepareAddStatement() also being successful (since syntax itself is ok), the outer while loop got stuck and no error message was logged. I've seen other projects use mysql_get_options with MYSQL_OPT_MAX_ALLOWED_PACKET to detect possible overflow case and avoid connection dropping issues. Perhaps something similar could be done in gearman?