libdrizzle: failed non-blocking connects do not report error

Bug #879027 reported by Evan Jones
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
In Progress
Low
Brian Aker

Bug Description

1. Use an external event loop with libdrizzle
2. Try to connect to a non-existent server.
3. The connect will succeed, but the next operation will fail.

The problem is that libdrizzle assumes the event loop will set POLLERR if the non-blocking connect fails. However, libdrizzle only ever passes POLLOUT to drizzle_con_set_events, and thus the external event loop never knows it should watch for errors. Worse, libevent, probably the most popular event loop library, never sets error indicators, and only ever sets the equivalent of POLLIN and POLLOUT. The reason, as far as I can tell, is that some polling mechanisms don't return error indications{

The attached patch fixes this by checking getsockopt to see if the connect succeeded or failed. I haven't tested this in libdrizzle itself (I maintain my own copy in my project), but this works for me. Thanks!

Related branches

Revision history for this message
Evan Jones (evanj) wrote :
Brian Aker (brianaker)
Changed in drizzle:
status: New → In Progress
assignee: nobody → Brian Aker (brianaker)
importance: Undecided → Low
Vijay Samuel (vjsamuel)
Changed in drizzle:
status: In Progress → Fix Released
Revision history for this message
Brian Aker (brianaker) wrote :

See the attached branch (and confirm for yourself if it works).

Changed in drizzle:
milestone: none → 7.1.36
status: Fix Released → In Progress
Revision history for this message
Evan Jones (evanj) wrote :

Sorry; I'm not actively working on the project that uses libdrizzle any more, so it took me a while to verify this. It looks like it works to me: it now actually reports connection errors!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.