Skip to content

Instantly share code, notes, and snippets.

@radixhound
Created June 22, 2011 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radixhound/1040502 to your computer and use it in GitHub Desktop.
Save radixhound/1040502 to your computer and use it in GitHub Desktop.
mysql2 error where the connection is still waiting for a result.
##
# added output to test the state at query and result
#
def query(sql, opts={})
puts "#{Time.now.to_f}\t#{Fiber.current.object_id}\tQUERY: #{sql}"
if ::EM.reactor_running?
super(sql, opts.merge(:async => true))
deferrable = ::EM::DefaultDeferrable.new
::EM.watch(self.socket, Watcher, self, deferrable).notify_readable = true
fiber = Fiber.current
deferrable.callback do |result|
puts "#{Time.now.to_f}\t#{fiber.object_id}\t--------- #{result.inspect}"
fiber.resume(result)
end
deferrable.errback do |err|
fiber.resume(err)
end
Fiber.yield.tap do |result|
raise result if result.is_a?(Exception)
end
else
super(sql, opts)
end
end
1308763310.57352 2162922460 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763310.6067579 2162922460 QUERY: SHOW TABLES
1308763310.607478 2162922460 QUERY: DESCRIBE `food_types`
1308763310.690026 2162922460 QUERY: SHOW TABLES
1308763310.690645 2162922460 QUERY: DESCRIBE `source_types`
1308763315.184555 2178849220 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763315.239977 2178849220 --------- nil
1308763315.240171 2178849220 QUERY: SHOW FIELDS FROM `users`
1308763315.241476 2178849220 --------- #<Mysql2::Result:0x00000105859340>
1308763315.242319 2178849220 QUERY: SHOW TABLES
1308763315.242744 2178849220 --------- #<Mysql2::Result:0x00000105856c58>
1308763315.242838 2178849220 QUERY: DESCRIBE `users`
1308763315.243534 2178849220 --------- #<Mysql2::Result:0x00000105855a60>
1308763315.2559628 2178849220 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b1df715b03fe000098' LIMIT 1
1308763315.256371 2178849220 --------- #<Mysql2::Result:0x00000105809ac0>
1308763315.256502 2178849220 QUERY: SHOW TABLES
1308763315.25693 2178849220 --------- #<Mysql2::Result:0x00000105808b20>
1308763315.257024 2178849220 QUERY: DESCRIBE `users`
1308763315.2578828 2178849220 --------- #<Mysql2::Result:0x00000105807a90>
1308763315.2631638 2178849220 QUERY: BEGIN
1308763315.263354 2178849220 --------- nil
1308763315.296918 2178849220 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b1df715b03fe000098' AND `users`.`mongo_id` != '4e0224b1df715b03fe000098') LIMIT 1
1308763315.2972019 2178849220 --------- #<Mysql2::Result:0x00000102ea0990>
1308763315.297747 2178849220 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix6170' AND `users`.`mongo_id` != '4e0224b1df715b03fe000098') LIMIT 1
1308763315.30178 2178849220 --------- #<Mysql2::Result:0x00000102e74fe8>
1308763315.302888 2178849220 QUERY: UPDATE `users` SET `username` = 'radix6170' WHERE `users`.`mongo_id` = '4e0224b1df715b03fe000098'
1308763315.303204 2178849220 --------- nil
1308763315.303352 2178849220 QUERY: COMMIT
1308763315.303461 2178849220 --------- nil
1308763315.340679 2170359300 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763315.341064 2170359300 --------- nil
1308763315.341415 2170359300 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b1df715b03fe000099' LIMIT 1
1308763315.342326 2170359300 --------- #<Mysql2::Result:0x00000102b739c0>
1308763315.343733 2170359300 QUERY: BEGIN
1308763315.344167 2170359300 --------- nil
1308763315.3453062 2170359300 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b1df715b03fe000099' AND `users`.`mongo_id` != '4e0224b1df715b03fe000099') LIMIT 1
1308763315.345619 2170359300 --------- #<Mysql2::Result:0x00000102b13340>
1308763315.3463051 2170359300 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix2147' AND `users`.`mongo_id` != '4e0224b1df715b03fe000099') LIMIT 1
1308763315.3489769 2170359300 --------- #<Mysql2::Result:0x00000102ae39b0>
1308763315.349499 2170359300 QUERY: UPDATE `users` SET `username` = 'radix2147' WHERE `users`.`mongo_id` = '4e0224b1df715b03fe000099'
1308763315.3497758 2170359300 --------- nil
1308763315.349858 2170359300 QUERY: COMMIT
1308763315.349953 2170359300 --------- nil
1308763315.541446 2168964060 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763315.541724 2168964060 --------- nil
1308763315.542054 2168964060 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b1df715b03fe00009a' LIMIT 1
1308763315.542658 2168964060 --------- #<Mysql2::Result:0x00000102990bf8>
1308763315.543236 2168964060 QUERY: BEGIN
1308763315.543401 2168964060 --------- nil
1308763315.5441658 2168964060 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b1df715b03fe00009a' AND `users`.`mongo_id` != '4e0224b1df715b03fe00009a') LIMIT 1
1308763315.544545 2168964060 --------- #<Mysql2::Result:0x00000102d41220>
1308763315.545032 2168964060 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix5450' AND `users`.`mongo_id` != '4e0224b1df715b03fe00009a') LIMIT 1
1308763315.547775 2168964060 --------- #<Mysql2::Result:0x00000102f205c8>
1308763315.5484061 2168964060 QUERY: UPDATE `users` SET `username` = 'radix5450' WHERE `users`.`mongo_id` = '4e0224b1df715b03fe00009a'
1308763315.549035 2168964060 --------- nil
1308763315.5492082 2168964060 QUERY: COMMIT
1308763315.549398 2168964060 --------- nil
1308763315.728906 2178840640 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763315.729147 2178840640 --------- nil
1308763315.729425 2178840640 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b1df715b03fe00009b' LIMIT 1
1308763315.729892 2178840640 --------- #<Mysql2::Result:0x00000103b35548>
1308763315.730328 2178840640 QUERY: BEGIN
1308763315.730489 2178840640 --------- nil
1308763315.731067 2178840640 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b1df715b03fe00009b' AND `users`.`mongo_id` != '4e0224b1df715b03fe00009b') LIMIT 1
1308763315.7312489 2178840640 --------- #<Mysql2::Result:0x00000103aca540>
1308763315.7316532 2178840640 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix1400' AND `users`.`mongo_id` != '4e0224b1df715b03fe00009b') LIMIT 1
1308763315.735313 2178840640 --------- #<Mysql2::Result:0x00000103ab5b68>
1308763315.7356741 2178840640 QUERY: UPDATE `users` SET `username` = 'radix1400' WHERE `users`.`mongo_id` = '4e0224b1df715b03fe00009b'
1308763315.736008 2178840640 --------- nil
1308763315.736096 2178840640 QUERY: COMMIT
1308763315.7362099 2178840640 --------- nil
1308763315.905112 2176869460 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763315.9053571 2176869460 --------- nil
1308763315.90565 2176869460 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b1df715b03fe00009c' LIMIT 1
1308763315.905937 2176869460 --------- #<Mysql2::Result:0x00000102fe7fb0>
1308763315.906776 2162922460 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763315.907596 2162922460 --------- nil
1308763316.0848792 2171225300 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763316.085123 2171225300 --------- nil
1308763316.085349 2171225300 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b1df715b03fe00009d' LIMIT 1
1308763316.08566 2171225300 --------- #<Mysql2::Result:0x00000102d1b638>
1308763316.086457 2162922460 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763316.086621 2162922460 QUERY: BEGIN
1308763316.265804 2169240100 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763316.2660851 2169240100 --------- nil
1308763316.266368 2169240100 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b2df715b03fe00009e' LIMIT 1
1308763316.266815 2169240100 --------- #<Mysql2::Result:0x0000010296ed00>
1308763316.267236 2169240100 QUERY: BEGIN
1308763316.267349 2169240100 --------- nil
1308763316.2679539 2169240100 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b2df715b03fe00009e' AND `users`.`mongo_id` != '4e0224b2df715b03fe00009e') LIMIT 1
1308763316.268178 2169240100 --------- #<Mysql2::Result:0x0000010293a118>
1308763316.2686012 2169240100 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix2000' AND `users`.`mongo_id` != '4e0224b2df715b03fe00009e') LIMIT 1
1308763316.2691169 2169240100 --------- #<Mysql2::Result:0x00000102921d48>
1308763316.269412 2169240100 QUERY: UPDATE `users` SET `username` = 'radix2000' WHERE `users`.`mongo_id` = '4e0224b2df715b03fe00009e'
1308763316.269631 2169240100 --------- nil
1308763316.269712 2169240100 QUERY: COMMIT
1308763316.269817 2169240100 --------- nil
1308763316.451033 2168497200 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763316.4513001 2168497200 --------- nil
1308763316.451524 2168497200 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b2df715b03fe00009f' LIMIT 1
1308763316.4520361 2168497200 --------- #<Mysql2::Result:0x00000102809488>
1308763316.45246 2168497200 QUERY: BEGIN
1308763316.452589 2168497200 --------- nil
1308763316.453242 2168497200 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b2df715b03fe00009f' AND `users`.`mongo_id` != '4e0224b2df715b03fe00009f') LIMIT 1
1308763316.453525 2168497200 --------- #<Mysql2::Result:0x00000101fe68c8>
1308763316.453971 2168497200 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix5100' AND `users`.`mongo_id` != '4e0224b2df715b03fe00009f') LIMIT 1
1308763316.456587 2168497200 --------- #<Mysql2::Result:0x00000101fd65b8>
1308763316.4568908 2168497200 QUERY: UPDATE `users` SET `username` = 'radix5100' WHERE `users`.`mongo_id` = '4e0224b2df715b03fe00009f'
1308763316.457207 2168497200 --------- nil
1308763316.457293 2168497200 QUERY: COMMIT
1308763316.457394 2168497200 --------- nil
1308763316.63429 2161737260 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763316.6345758 2161737260 --------- nil
1308763316.634808 2161737260 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b2df715b03fe0000a0' LIMIT 1
1308763316.635325 2161737260 --------- #<Mysql2::Result:0x00000101af5af8>
1308763316.6357539 2161737260 QUERY: BEGIN
1308763316.635862 2161737260 --------- nil
1308763316.6364732 2161737260 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b2df715b03fe0000a0' AND `users`.`mongo_id` != '4e0224b2df715b03fe0000a0') LIMIT 1
1308763316.6366699 2161737260 --------- #<Mysql2::Result:0x00000101a7fda8>
1308763316.637093 2161737260 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix5734' AND `users`.`mongo_id` != '4e0224b2df715b03fe0000a0') LIMIT 1
1308763316.639922 2161737260 --------- #<Mysql2::Result:0x00000101a22ea0>
1308763316.640246 2161737260 QUERY: UPDATE `users` SET `username` = 'radix5734' WHERE `users`.`mongo_id` = '4e0224b2df715b03fe0000a0'
1308763316.640518 2161737260 --------- nil
1308763316.640604 2161737260 QUERY: COMMIT
1308763316.640755 2161737260 --------- nil
1308763316.815731 2153331940 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763316.81597 2153331940 --------- nil
1308763316.816202 2153331940 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b2df715b03fe0000a1' LIMIT 1
1308763316.8166049 2153331940 --------- #<Mysql2::Result:0x000001058ad3f0>
1308763316.817021 2153331940 QUERY: BEGIN
1308763316.8171258 2153331940 --------- nil
1308763316.8177128 2153331940 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b2df715b03fe0000a1' AND `users`.`mongo_id` != '4e0224b2df715b03fe0000a1') LIMIT 1
1308763316.817882 2153331940 --------- #<Mysql2::Result:0x000001058bdf48>
1308763316.818302 2153331940 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix6221' AND `users`.`mongo_id` != '4e0224b2df715b03fe0000a1') LIMIT 1
1308763316.8188422 2153331940 --------- #<Mysql2::Result:0x00000100c8c980>
1308763316.819146 2153331940 QUERY: UPDATE `users` SET `username` = 'radix6221' WHERE `users`.`mongo_id` = '4e0224b2df715b03fe0000a1'
1308763316.819345 2153331940 --------- nil
1308763316.819424 2153331940 QUERY: COMMIT
1308763316.819519 2153331940 --------- nil
1308763316.989999 2194198200 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763316.990266 2194198200 --------- nil
1308763316.990548 2194198200 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b2df715b03fe0000a2' LIMIT 1
1308763316.9909172 2194198200 --------- #<Mysql2::Result:0x00000104854990>
1308763316.991321 2194198200 QUERY: BEGIN
1308763316.991425 2194198200 --------- nil
1308763316.992018 2194198200 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b2df715b03fe0000a2' AND `users`.`mongo_id` != '4e0224b2df715b03fe0000a2') LIMIT 1
1308763316.992237 2194198200 --------- #<Mysql2::Result:0x0000010485d4f0>
1308763316.992633 2194198200 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix7591' AND `users`.`mongo_id` != '4e0224b2df715b03fe0000a2') LIMIT 1
1308763316.995255 2194198200 --------- #<Mysql2::Result:0x00000104866f00>
1308763316.995557 2194198200 QUERY: UPDATE `users` SET `username` = 'radix7591' WHERE `users`.`mongo_id` = '4e0224b2df715b03fe0000a2'
1308763316.99584 2194198200 --------- nil
1308763316.995917 2194198200 QUERY: COMMIT
1308763316.996074 2194198200 --------- nil
1308763317.180174 2178987140 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763317.180413 2178987140 --------- nil
1308763317.180647 2178987140 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a3' LIMIT 1
1308763317.181041 2178987140 --------- #<Mysql2::Result:0x0000010486dd78>
1308763317.181451 2178987140 QUERY: BEGIN
1308763317.181559 2178987140 --------- nil
1308763317.1821492 2178987140 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a3' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a3') LIMIT 1
1308763317.182431 2178987140 --------- #<Mysql2::Result:0x000001048768d8>
1308763317.18283 2178987140 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix6624' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a3') LIMIT 1
1308763317.185317 2178987140 --------- #<Mysql2::Result:0x000001048802e8>
1308763317.185642 2178987140 QUERY: UPDATE `users` SET `username` = 'radix6624' WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a3'
1308763317.185996 2178987140 --------- nil
1308763317.1860821 2178987140 QUERY: COMMIT
1308763317.18626 2178987140 --------- nil
1308763317.324682 2198012820 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763317.324933 2198012820 --------- nil
1308763317.325192 2198012820 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a3' LIMIT 1
1308763317.325536 2198012820 --------- #<Mysql2::Result:0x00000103c293a0>
1308763317.325956 2198012820 QUERY: BEGIN
1308763317.326061 2198012820 --------- nil
1308763317.3266718 2198012820 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a3' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a3') LIMIT 1
1308763317.326897 2198012820 --------- #<Mysql2::Result:0x000001009f1e78>
1308763317.327303 2198012820 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix4189' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a3') LIMIT 1
1308763317.329534 2198012820 --------- #<Mysql2::Result:0x000001009fb888>
1308763317.369416 2198012820 QUERY: ROLLBACK
1308763317.379591 2197937540 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763317.3889542 2194098360 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763317.389194 2198012820 --------- nil
1308763317.3898082 2197937540 --------- nil
1308763317.390157 2197937540 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a4' LIMIT 1
1308763317.3902469 2194098360 --------- nil
1308763317.3904278 2194098360 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a4' LIMIT 1
1308763317.390932 2197937540 --------- #<Mysql2::Result:0x000001058da968>
1308763317.391381 2197937540 QUERY: BEGIN
1308763317.391505 2194098360 --------- #<Mysql2::Result:0x000001058d5620>
1308763317.39185 2194098360 QUERY: BEGIN
1308763317.3919349 2197937540 --------- nil
1308763317.392639 2197937540 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a4' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a4') LIMIT 1
1308763317.3927941 2194098360 --------- nil
1308763317.393337 2194098360 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a4' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a4') LIMIT 1
1308763317.393489 2197937540 --------- #<Mysql2::Result:0x000001058c0978>
1308763317.3939378 2197937540 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix4412' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a4') LIMIT 1
1308763317.3940842 2194098360 --------- #<Mysql2::Result:0x000001058b8b60>
1308763317.3945549 2194098360 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix4415' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a4') LIMIT 1
1308763317.394736 2197937540 --------- #<Mysql2::Result:0x000001058ae098>
1308763317.395359 2197937540 QUERY: UPDATE `users` SET `username` = 'radix4412' WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a4'
1308763317.395503 2194098360 --------- #<Mysql2::Result:0x000001058ab910>
1308763317.395766 2194098360 QUERY: UPDATE `users` SET `username` = 'radix4415' WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a4'
1308763317.39587 2197937540 --------- nil
1308763317.395998 2197937540 QUERY: COMMIT
1308763317.3961082 2194098360 --------- nil
1308763317.3961852 2194098360 QUERY: COMMIT
1308763317.396265 2197937540 --------- nil
1308763317.396977 2194098360 --------- nil
1308763317.5541701 2185447180 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763317.554373 2185447180 --------- nil
1308763317.554616 2185447180 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a5' LIMIT 1
1308763317.555012 2185447180 --------- #<Mysql2::Result:0x00000104862e50>
1308763317.5554109 2185447180 QUERY: BEGIN
1308763317.5555148 2185447180 --------- nil
1308763317.5560808 2185447180 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a5' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a5') LIMIT 1
1308763317.5562801 2185447180 --------- #<Mysql2::Result:0x00000104853310>
1308763317.556672 2185447180 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix1131' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a5') LIMIT 1
1308763317.559236 2185447180 --------- #<Mysql2::Result:0x00000103c24170>
1308763317.559547 2185447180 QUERY: UPDATE `users` SET `username` = 'radix1131' WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a5'
1308763317.559859 2185447180 --------- nil
1308763317.559944 2185447180 QUERY: COMMIT
1308763317.5601 2185447180 --------- nil
1308763317.573001 2178225480 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763317.573298 2178225480 --------- nil
1308763317.5735722 2178225480 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a5' LIMIT 1
1308763317.5740879 2178225480 --------- #<Mysql2::Result:0x00000103a5ca18>
1308763317.574511 2178225480 QUERY: BEGIN
1308763317.574635 2178225480 --------- nil
1308763317.575217 2178225480 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a5' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a5') LIMIT 1
1308763317.575451 2178225480 --------- #<Mysql2::Result:0x00000103a4f930>
1308763317.5758889 2178225480 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix4291' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a5') LIMIT 1
1308763317.578532 2178225480 --------- #<Mysql2::Result:0x00000103a1a3c0>
1308763317.578901 2178225480 QUERY: UPDATE `users` SET `username` = 'radix4291' WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a5'
1308763317.5792372 2178225480 --------- nil
1308763317.579335 2178225480 QUERY: COMMIT
1308763317.579456 2178225480 --------- nil
1308763317.7542899 2172260880 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763317.7640011 2171064500 QUERY: SET SQL_AUTO_IS_NULL=0, @@wait_timeout = 2592000
1308763317.764173 2172260880 --------- nil
1308763317.7644002 2172260880 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a6' LIMIT 1
1308763317.764731 2171064500 --------- nil
1308763317.7648928 2171064500 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a6' LIMIT 1
1308763317.765186 2172260880 --------- #<Mysql2::Result:0x00000102c6f680>
1308763317.7655869 2172260880 QUERY: BEGIN
1308763317.7657049 2171064500 --------- #<Mysql2::Result:0x00000102c52418>
1308763317.766043 2171064500 QUERY: BEGIN
1308763317.766125 2172260880 --------- nil
1308763317.7666829 2172260880 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a6' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a6') LIMIT 1
1308763317.766798 2171064500 --------- nil
1308763317.767256 2171064500 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a6' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a6') LIMIT 1
1308763317.767373 2172260880 --------- #<Mysql2::Result:0x00000102ba8328>
1308763317.767757 2172260880 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix5971' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a6') LIMIT 1
1308763317.767873 2171064500 --------- #<Mysql2::Result:0x00000102ba0c68>
1308763317.768285 2171064500 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix5372' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a6') LIMIT 1
1308763317.770807 2172260880 --------- #<Mysql2::Result:0x00000102b5b730>
1308763317.771107 2172260880 QUERY: UPDATE `users` SET `username` = 'radix5971' WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a6'
1308763317.771265 2171064500 --------- #<Mysql2::Result:0x00000102b46010>
1308763317.771551 2171064500 QUERY: UPDATE `users` SET `username` = 'radix5372' WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a6'
1308763317.771662 2172260880 --------- nil
1308763317.771743 2172260880 QUERY: COMMIT
1308763317.771843 2171064500 --------- nil
1308763317.771928 2171064500 QUERY: COMMIT
1308763317.7720041 2172260880 --------- nil
1308763317.7725189 2171064500 --------- nil
1308763318.8289359 2185469500 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b4df715b03fe0000ab' LIMIT 1
1308763318.82931 2193824940 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b4df715b03fe0000ab' LIMIT 1
1308763318.829577 2194197520 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b4df715b03fe0000aa' LIMIT 1
1308763318.8298082 2197851500 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b4df715b03fe0000a9' LIMIT 1
1308763318.8300369 2163202560 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b4df715b03fe0000a9' LIMIT 1
1308763318.830261 2152954080 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b4df715b03fe0000a8' LIMIT 1
1308763318.835781 2161958060 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a7' LIMIT 1
1308763318.8360078 2164202760 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a7' LIMIT 1
1308763318.836407 2168954100 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b3df715b03fe0000a6' LIMIT 1
1308763318.8474839 2178086740 QUERY: SELECT `users`.* FROM `users` WHERE `users`.`mongo_id` = '4e0224b4df715b03fe0000ab' LIMIT 1
1308763318.8476632 2185469500 --------- #<Mysql2::Result:0x00000103a5baf0>
1308763318.848074 2185469500 QUERY: BEGIN
1308763318.848171 2193824940 --------- #<Mysql2::Result:0x00000103a56e38>
1308763318.8485062 2193824940 QUERY: BEGIN
1308763318.848605 2194197520 --------- #<Mysql2::Result:0x00000103a52400>
1308763318.8489459 2194197520 QUERY: BEGIN
1308763318.849044 2197851500 --------- #<Mysql2::Result:0x00000103a2bb70>
1308763318.849385 2197851500 QUERY: BEGIN
1308763318.849476 2163202560 --------- #<Mysql2::Result:0x00000103a1d638>
1308763318.849809 2163202560 QUERY: BEGIN
1308763318.849899 2152954080 --------- #<Mysql2::Result:0x00000103a14df8>
1308763318.8502378 2152954080 QUERY: BEGIN
1308763318.850332 2161958060 --------- #<Mysql2::Result:0x00000103a07f90>
1308763318.850667 2161958060 QUERY: BEGIN
1308763318.8507578 2164202760 --------- #<Mysql2::Result:0x000001039e5e18>
1308763318.8510919 2164202760 QUERY: BEGIN
1308763318.851306 2168954100 --------- #<Mysql2::Result:0x000001039df2c0>
1308763318.851648 2168954100 QUERY: BEGIN
1308763318.851739 2178086740 --------- #<Mysql2::Result:0x000001039c9fb0>
1308763318.851925 2185469500 --------- nil
1308763318.852473 2185469500 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b4df715b03fe0000ab' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000ab') LIMIT 1
1308763318.8525581 2193824940 --------- nil
1308763318.8530078 2193824940 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b4df715b03fe0000ab' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000ab') LIMIT 1
1308763318.8530931 2194197520 --------- nil
1308763318.8535402 2194197520 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b4df715b03fe0000aa' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000aa') LIMIT 1
1308763318.8536232 2197851500 --------- nil
1308763318.854076 2197851500 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b4df715b03fe0000a9' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000a9') LIMIT 1
1308763318.854157 2163202560 --------- nil
1308763318.85462 2163202560 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b4df715b03fe0000a9' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000a9') LIMIT 1
1308763318.854701 2152954080 --------- nil
1308763318.855168 2152954080 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b4df715b03fe0000a8' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000a8') LIMIT 1
1308763318.855253 2161958060 --------- nil
1308763318.8557088 2161958060 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a7' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a7') LIMIT 1
1308763318.855792 2164202760 --------- nil
1308763318.856246 2164202760 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a7' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a7') LIMIT 1
1308763318.856799 2162922460 QUERY: BEGIN
1308763318.857392 2162922460 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b4df715b03fe0000ab' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000ab') LIMIT 1
1308763318.857524 2162922460 QUERY: ROLLBACK
1308763318.8586729 2168954100 --------- nil
1308763318.8591151 2168954100 QUERY: SELECT 1 FROM `users` WHERE (`users`.`mongo_id` = '4e0224b3df715b03fe0000a6' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a6') LIMIT 1
1308763318.85921 2185469500 --------- #<Mysql2::Result:0x00000102f1d4e0>
1308763318.859616 2185469500 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix3724' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000ab') LIMIT 1
1308763318.859705 2193824940 --------- #<Mysql2::Result:0x00000102eec4f8>
1308763318.860106 2193824940 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix3009' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000ab') LIMIT 1
1308763318.8601978 2194197520 --------- #<Mysql2::Result:0x00000102eca150>
1308763318.8605921 2194197520 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix7219' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000aa') LIMIT 1
1308763318.860684 2197851500 --------- #<Mysql2::Result:0x00000102ea5d78>
1308763318.861077 2197851500 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix6447' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000a9') LIMIT 1
1308763318.861165 2163202560 --------- #<Mysql2::Result:0x00000102e74e30>
1308763318.8615549 2163202560 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix8212' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000a9') LIMIT 1
1308763318.861643 2152954080 --------- #<Mysql2::Result:0x00000102e60228>
1308763318.862039 2152954080 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix1791' AND `users`.`mongo_id` != '4e0224b4df715b03fe0000a8') LIMIT 1
1308763318.8621309 2161958060 --------- #<Mysql2::Result:0x00000102e43678>
1308763318.862526 2161958060 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix873' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a7') LIMIT 1
1308763318.862659 2164202760 --------- #<Mysql2::Result:0x00000102e22b58>
1308763318.863355 2164202760 QUERY: SELECT 1 FROM `users` WHERE (`users`.`username` = 'radix3096' AND `users`.`mongo_id` != '4e0224b3df715b03fe0000a7') LIMIT 1
@radixhound
Copy link
Author

In this test I'm creating 20 threads that create a new user then update the user twice. At the beginning everything is orderly because the create user process is synchronous and each thread takes turns creating a user. Then when the threads start updating users, things get all async and that when eventually the 'This connection is still waiting for a result, try again once you have the result' error happens.

@dimaspriyanto
Copy link

how do you fix the error radix?

@radixhound
Copy link
Author

In the end I overcame my problem by discovering that the error only occurred when the auth verification request which was happening asynchronously came back after the mysql user request came back. So I simply made the mysql user request wait until the auth completed to return its results. It's not ideal but it worked. I think the work that Ilya Grigorik is doing with the mysql2 fiber stuff will take care of these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment