Last modified: 2014-04-07 18:20:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T56303, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 54303 - Incorrect return value checks in collector component of webstatscollector
Incorrect return value checks in collector component of webstatscollector
Status: NEW
Product: Datasets
Classification: Unclassified
Webstatscollector (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-19 02:10 UTC by Diederik van Liere
Modified: 2014-04-07 18:20 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Diederik van Liere 2013-09-19 02:10:24 UTC
from IRC conversation with Brandon Black:
<bblack> I did notice there are a number of obvious bugs in the collector source, but they're unlikely to have a big effect most of the time
<bblack> e.g. you'll see this pattern in a few places:
<bblack>  /* Process incoming UDP queue */
<bblack>                 while(( fds[0].revents & POLLIN ) &&
<bblack>                         ((l=recvfrom(s,&buf,1500,0,NULL,NULL))!=-1)) {
<bblack>                                 if (l==EAGAIN)
<bblack>                                         break;
<bblack>                                 handleMessage((char *)&buf,l);
<bblack>                         }
<bblack> "l" (return value from recvfrom() or similar network calls) will never be EAGAIN.  you would actually check for errno==EAGAIN when l==-1
<bblack> so those EAGAIN / EWOULDBLOCK checks are just wrong
<bblack> actually I think the way that code ends up working, it's skipping any packet it receives that is 11 bytes in length (because EAGAIN happens to be error code 11), and then again also not handling the true EAGAIN case very well (but well enough, since the outer loop is simple)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links