Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bccc crashes after a few seconds #9

Closed
Zackrobat opened this issue May 30, 2012 · 11 comments
Closed

bccc crashes after a few seconds #9

Zackrobat opened this issue May 30, 2012 · 11 comments
Labels

Comments

@Zackrobat
Copy link

I'm using Ubuntu

08:24:39 [zbrown] ~/Desktop/bccc/bccc/bccc$ uname -a
Linux zbrown-desktop 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 i686 i686 i386 GNU/Linux
08:30:09 [zbrown] ~/Desktop/bccc/bccc/bccc$

I followed the instructions on https://github.com/Schnouki/bccc to build and install bccc. But when I run it, I get the following error:

06:34:23 [zbrown] ~/Desktop/bccc/bccc/bccc$ bccc

Traceback (most recent call last):
File "/usr/local/bin/bccc", line 5, in
pkg_resources.run_script('bccc==0.0.1', 'bccc')
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 499, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1236, in run_script
exec(compile(open(script_filename).read(), script_filename, 'exec'), namespace, namespace)
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/EGG-INFO/scripts/bccc", line 70, in
ui.run()
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/ui.py", line 101, in run
self.loop.run()
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 274, in run
self.screen.run_wrapper(self._run)
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/raw_display.py", line 237, in run_wrapper
return fn()
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 307, in _run
self.event_loop.run()
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 682, in run
self._loop()
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 720, in _loop
self._watch_filesfd
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 187, in cb
rval = callback(data)
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/ui.py", line 135, in _handle_callback
func(_args, *_kwargs)
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/sidebar.py", line 76, in pubsub_posts_callback
if atom_pub > self.most_recent_activity:
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/util.py", line 33, in utcoffset
if self._isdst(dt):
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/util.py", line 51, in _isdst
stamp = time.mktime(tt)
OverflowError: mktime argument out of range
08:24:32 [zbrown] ~/Desktop/bccc/bccc/bccc$

@Schnouki
Copy link
Owner

Interesting. Apparently the error is in the code that converts server time to your local timezone.
What channel were you browsing when bccc crashed, and in which timezone do you live?

@Zackrobat
Copy link
Author

09:36:49 [zbrown] ~/Desktop/bccc/bccc/bccc$ date +%z
-0400
09:36:53 [zbrown] ~/Desktop/bccc/bccc/bccc$

The bccc UI was only active for a couple of seconds, and since I've
never used it before, I'm not sure what channel it was set to browse.
If there's a default channel, I was probably browsing that.

On Wed, May 30, 2012 at 9:10 AM, Thomas Jost
reply@reply.github.com
wrote:

Interesting. Apparently the error is in the code that converts server time to your local timezone.
What channel were you browsing when bccc crashed, and in which timezone do you live?


Reply to this email directly or view it on GitHub:
#9 (comment)

Zack Brown

@Schnouki
Copy link
Owner

The default is to browse your personal channel. If you tell me your
channel JID I'll be able to do some tests and try to fix this problem.

@Zackrobat
Copy link
Author

jid = zackrobat@buddycloud.org

@Schnouki
Copy link
Owner

Your channel is private. Could you please accept my request to subscribe to it?

@Zackrobat
Copy link
Author

I have done so.

@Schnouki
Copy link
Owner

Hmm, I can't reproduce this issue, I can display your channel without any trouble. So I'll need some help :)

Could you please:

  1. enable logging in your config file
  2. replace the LocalTimezone._isdst() method in bccc/ui/util.py (lines 47--53) with http://pastebin.com/sujEKYpc
  3. make bccc crash again
  4. post the end of the log, especially the line with "OverflowError".

(The best would be to set the log level to "debug", remove your password from the log and mail it to me at schnouki@schnouki.net)

@Zackrobat
Copy link
Author

OK. Logging was already enabled at the "warning" level, so I left it as it was.

I replaced the _isdst with the code from the link you included.

I rebuilt and reinstalled bccc

I ran bccc. It lasted a few seconds longer this time, then crashed with the following message:

"Fatal Python error. Cannot recover from stack overflow. Aborted (core dumped)"

I looked in ~/.bccc.log and found it was empty.

I changed the logging level to 'debug' and ran bccc again. I got the same error at crashtime.

This time when I looked in ~/.bccc.log I got a metric ton of output, but none of it included "OverflowError" anywhere.

Here are the last several lines of the log file:

2012-05-31 06:00:34,330 sleekxmpp.xmlstream.xmlstream:DEBUG RECV:
2012-05-31 06:00:34,332 sleekxmpp.xmlstream.xmlstream:DEBUG SEND:
2012-05-31 06:00:34,572 sleekxmpp.xmlstream.xmlstream:DEBUG RECV:
2012-05-31 06:00:34,573 sleekxmpp.plugins.xep_0030.disco:DEBUG Received disco items result frombuddycloud.org to zackrobat@buddycloud.org/901f8766-d844-4a90-87e9-97581ae694cf.
2012-05-31 06:00:34,574 sleekxmpp.plugins.xep_0030.disco:DEBUG Received disco info result fromchannels.buddycloud.org to zackrobat@buddycloud.org/901f8766-d844-4a90-87e9-97581ae694cf.
2012-05-31 06:00:34,584 sleekxmpp.plugins.xep_0030.disco:DEBUG Received disco info result fromtopics.buddycloud.org to zackrobat@buddycloud.org/901f8766-d844-4a90-87e9-97581ae694cf.
2012-05-31 06:00:34,585 sleekxmpp.plugins.xep_0030.disco:DEBUG Received disco info result fromanon.buddycloud.org to zackrobat@buddycloud.org/901f8766-d844-4a90-87e9-97581ae694cf.
2012-05-31 06:00:34,586 sleekxmpp.plugins.xep_0030.disco:DEBUG Received disco info result fromsearch.buddycloud.org to zackrobat@buddycloud.org/901f8766-d844-4a90-87e9-97581ae694cf.
2012-05-31 06:00:34,587 sleekxmpp.plugins.xep_0030.disco:DEBUG Received disco info result fromoembed.buddycloud.org to zackrobat@buddycloud.org/901f8766-d844-4a90-87e9-97581ae694cf.

@Schnouki
Copy link
Owner

Wow, a stack overflow in the CPython interpreter caused by pure Python code -- I don't think I had managed to do that yet.
I think the problem in the patch I sent you is that calling str(dt) triggers a call to _isdst(), which raises an exception that causes a call to str(dt), etc., infinite recursion, and boom stack overflow :D

Here's a new version of _isdst without the call to str(dt): http://pastebin.com/Pi8Ft9nk
Could you please tell me if this one "works" (i.e. OverflowError, not stack overflow in Python interpreter), and if it does, could you please mail me the full log? (gzip it if it's too big...)

@Zackrobat
Copy link
Author

OK, I used your new version of _isdst, and got this output from a run:

10:45:34 [zbrown] ~/Desktop/bccc/bccc$ bccc

Traceback (most recent call last):
File "/usr/local/bin/bccc", line 5, in
pkg_resources.run_script('bccc==0.0.1', 'bccc')
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 499, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1236, in run_script
exec(compile(open(script_filename).read(), script_filename, 'exec'), namespace, namespace)
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/EGG-INFO/scripts/bccc", line 70, in
ui.run()
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/ui.py", line 101, in run
self.loop.run()
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 274, in run
self.screen.run_wrapper(self._run)
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/raw_display.py", line 237, in run_wrapper
return fn()
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 307, in _run
self.event_loop.run()
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 682, in run
self._loop()
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 720, in _loop
self._watch_filesfd
File "/usr/local/lib/python3.2/dist-packages/urwid-1.0.1-py3.2-linux-i686.egg/urwid/main_loop.py", line 187, in cb
rval = callback(data)
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/ui.py", line 135, in _handle_callback
func(_args, *_kwargs)
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/sidebar.py", line 76, in pubsub_posts_callback
if atom_pub > self.most_recent_activity:
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/util.py", line 33, in utcoffset
if self._isdst(dt):
File "/usr/local/lib/python3.2/dist-packages/bccc-0.0.1-py3.2.egg/bccc/ui/util.py", line 52, in _isdst
stamp = time.mktime(tt)
OverflowError: mktime argument out of range
10:45:45 [zbrown] ~/Desktop/bccc/bccc$

This time the debugging output in the log file did include an overflow line:

2012-05-31 10:46:48,400 root:ERROR OverflowError: (1900, 1, 1, 0, 0, 0, 0, 0, 0) -- -1 day, 20:00:00 -- -1 day, 19:00:00

I've sent the full log file to you via email.

@Schnouki
Copy link
Owner

Ok, I've been able to reproduce this bug. It's i686-specific (I had to set up a 32bit chroot): on x86_64, time.mktime() returns negative timestamps when its arg has a year < 1970, but on i686 it raises OverflowError instead.

I'll push a workaround later; a cleaner fix would probably require adding a new dependency (pytz), which I would like to avoid.

Schnouki added a commit that referenced this issue Jun 1, 2012
dateutil.tz has a slightly better version of LocalTimezone called tzlocal. Let's
use this one.

Probably a better fix for #9 :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants