Last modified: 2014-08-02 07:21:42 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 T50012, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 48012 - Better error handling for worker.py
Better error handling for worker.py
Status: PATCH_TO_REVIEW
Product: Datasets
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Ariel T. Glenn
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-02 18:07 UTC by Sanja
Modified: 2014-08-02 07:21 UTC (History)
5 users (show)

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


Attachments
Added error handler for fatal errors in worker.py (1.05 KB, patch)
2013-05-02 18:09 UTC, Sanja
Details
Configurations checks. (1.89 KB, patch)
2013-05-09 20:38 UTC, Sanja
Details

Description Sanja 2013-05-02 18:07:34 UTC
Problem:
When I tried to dump database while the path to gzip executable was misconfigured, script didn’t exit immediately (since it cannot continue in a meaningful way), only printed the error and continued along, even though it could not do anything.

Explanation:
Looking into the current error handling, I saw it is set up to pass pass exceptions to python default exception handler. That is sufficient only when errors are non-fatal. But when fatal error occurs, if the script does not exit immediately, it starts spewing non-relevant error information and ultimately confuses the user.

Proposed solution:
Create another error handler (exception handler) for fatal errors, that would output the error message and exit the script on spot.

In the attachment is a simple implementation of error handler for fatal errors as well as fix for the issue described above on the spot where it was noticed.
Comment 1 Sanja 2013-05-02 18:09:27 UTC
Created attachment 12242 [details]
Added error handler for fatal errors in worker.py
Comment 2 Andre Klapper 2013-05-03 09:12:31 UTC
Hi! Thanks for your patch!

You are welcome to use Developer access
  https://www.mediawiki.org/wiki/Developer_access
to submit this as a Git branch directly into Gerrit:
  https://www.mediawiki.org/wiki/Git/Tutorial

Putting your branch in Git makes it easier to review it quickly.
Thanks again! We appreciate your contribution.
Comment 3 Matthew Flaschen 2013-05-03 20:45:12 UTC
I don't think __str__ should be doing the exit.  It should probably not have side effects at all, so I don't think this is quite the right approach.
Comment 4 Ariel T. Glenn 2013-05-07 07:20:24 UTC
Things like 'gzip isn't in the right place' really ought to be flagged well before we get to running individual dump steps.  It would be good to check all config file settings for sanity after they are read in.
Comment 5 Sanja 2013-05-08 10:34:25 UTC
Thank you all for your comments.
The proposed solution was the first thing that came on my mind, so I do know that it wasn't the best.
These days, I'm reading the code again, and searching the right spot for checking conf settings (the idea is to make a function which will call itself during the initialization).
Comment 6 Sanja 2013-05-09 20:38:16 UTC
Created attachment 12282 [details]
Configurations checks.

I've considered what you said, so I've made another patch for worker.py. It now checks for external programs existence in the initialization part.

Left to be done/discuss is what to do with checks that already exist, because they are now superfluous.
Comment 7 Andre Klapper 2013-05-13 13:37:25 UTC
Sanja: Any chance you could put that into Gerrit? See comment 2.
Comment 8 Hydriz Scholz 2013-05-13 13:38:16 UTC
It is in Gerrit.

Gerrit Change-Id: I3f7fafa6d2813931bf328bba6c519029ea412c99
Comment 9 Andre Klapper 2013-05-13 15:01:51 UTC
Thanks! (Adding "bug: 48012" as the last line in the patch commit message line will create an automatic comment in this bug report)
Comment 10 Ariel T. Glenn 2013-05-13 15:08:47 UTC
Ah please see my comments on the changeset, over on the gerrit side.
Comment 11 Gerrit Notification Bot 2013-05-14 22:08:26 UTC
Related URL: https://gerrit.wikimedia.org/r/63782 (Gerrit Change Ied6711771d4db7aae6858f1fccf0020e8297b4c7)
Comment 12 Gerrit Notification Bot 2013-12-13 22:12:28 UTC
Change 63390 had a related patch set uploaded by Nemo bis:
Per bug #48012. Patch for worker.py. It checks for external programs existence in the initialization part.

https://gerrit.wikimedia.org/r/63390
Comment 13 This, that and the other (TTO) 2014-08-02 07:21:42 UTC
Not a MediaWiki issue...

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


Navigation
Links