Py3status: Error in events.py line 30 on reloading i3

Created on 12 Aug 2016  路  14Comments  路  Source: ultrabug/py3status

Hi,

Whenever I restart, and not all the time, I got this message :

pyt3status: (error) events.py 30. Please try to fix and reload i3m 

My i3 and py3status versions are :

i3 version 4.11 (2015-09-30, branch "4.11") 漏 2009 Michael Stapelberg and contributors
py3status version 3.1rc0 (python 2.7.12)

Has anyone experience this problem ?

Thank you for all the good work !

bug

Most helpful comment

@amaurybrisou Thanks for reporting this issue.

Could you also post the error from the logs. py3status -c <config-path> -l <logfile-path> as that will help track down what's going wrong

All 14 comments

@amaurybrisou Thanks for reporting this issue.

Could you also post the error from the logs. py3status -c <config-path> -l <logfile-path> as that will help track down what's going wrong

2016-08-12 12:07:10 INFO i3status spawned using config file /tmp/py3status_fANTQ9
2016-08-12 12:07:18 WARNING  (error) events.py line 30.
2016-08-12 12:07:18 INFO Traceback
error: (4, 'Appel syst\xc3\xa8me interrompu')
  File "/usr/local/lib/python2.7/dist-packages/py3status-3.1rc0-py2.7.egg/py3status/i3status.py", line 332, in spawn_i3status
    err = self.poller_err.readline()
  File "/usr/local/lib/python2.7/dist-packages/py3status-3.1rc0-py2.7.egg/py3status/events.py", line 30, in readline
    poll_result = self.poller.poll(timeout)

2016-08-12 12:07:18 ERROR py3status:  (error) events.py line 30. Please try to fix this and reload i3wm (Mod+Shift+R)
2016-08-12 12:07:18 INFO i3status spawned using config file /tmp/py3status_vW_osW

does the following patch help in any way?

diff --git a/py3status/i3status.py b/py3status/i3status.py
index 0a2a58a..218ea07 100644
--- a/py3status/i3status.py
+++ b/py3status/i3status.py
@@ -329,7 +329,12 @@ class I3status(Thread):
                                 self.set_responses(json_list)
                                 self.ready = True
                         else:
-                            err = self.poller_err.readline()
+                            try:
+                                err = self.poller_err.readline()
+                            except IOError as e:
+                                if e[0] == 4:
+                                    continue
+
                             code = i3status_pipe.poll()
                             if code is not None:
                                 msg = 'i3status died'

Looks like it's all right, I'll tell you by the end of the week :) thanks you @tobes

No still raise the error mentioned above :octopus:

Do you have the traceback for the latest error?

@amaurybrisou I've made a new patch, this should cover a few more of the places things can go wrong with the file polling, by pushing it a bit further back.

It'd be helpful if you could try it, and see if it helps at all. I'd be interested in seeing any backtraces if you still have issues. There is still a .poll() in the error code that I don't like but I'd just like to understand the issue a bit more first

diff --git a/py3status/events.py b/py3status/events.py
index 8fb4d2b..64b1453 100644
--- a/py3status/events.py
+++ b/py3status/events.py
@@ -4,6 +4,7 @@ import sys
 from threading import Thread
 from subprocess import Popen, PIPE
 from json import loads
+from errno import EINTR

 from py3status.profiling import profile

@@ -27,7 +28,14 @@ class IOPoller:
         Try to read our I/O for 'timeout' milliseconds, return None otherwise.
         This makes calling and reading I/O non blocking !
         """
-        poll_result = self.poller.poll(timeout)
+
+        try:
+            poll_result = self.poller.poll(timeout)
+        except IOError as e:
+            if e[0] == EINTR:
+                # Interrupted system call
+                return None
+            raise (e)
         if poll_result:
             line = self.io.readline().strip()
             if self.io == sys.stdin and line == '[':
diff --git a/py3status/i3status.py b/py3status/i3status.py
index 0a2a58a..e15e2fd 100644
--- a/py3status/i3status.py
+++ b/py3status/i3status.py
@@ -330,6 +330,8 @@ class I3status(Thread):
                                 self.ready = True
                         else:
                             err = self.poller_err.readline()
+                            if not err:
+                                continue
                             code = i3status_pipe.poll()
                             if code is not None:
                                 msg = 'i3status died'

If you get a chance, am I right in thinking the issue goes away if you run py3status under python 3.x

Hello @tobes, I had the same traceback as before.

From now with your latest patch, error occurs when I switch tab and refresh ith 'ctrl'+'shift'+'R'.

Here is the log :

2016-08-13 08:47:49 WARNING  (error) events.py line 33.
2016-08-13 08:47:49 INFO Traceback
error: (4, 'Appel syst\xc3\xa8me interrompu')
  File "/usr/local/lib/python2.7/dist-packages/py3status-3.1rc0-py2.7.egg/py3status/i3status.py", line 332, in spawn_i3status
    err = self.poller_err.readline()
  File "/usr/local/lib/python2.7/dist-packages/py3status-3.1rc0-py2.7.egg/py3status/events.py", line 33, in readline
    poll_result = self.poller.poll(timeout)

2016-08-13 08:47:49 ERROR py3status:  (error) events.py line 33. Please try to fix this and reload i3wm (Mod+Shift+R)
2016-08-13 08:47:49 INFO i3status spawned using config file /tmp/py3status_vrCn_k

note: running in 2.7 I turn to 3.x now

With python3.5 no error if I refresh after switching tab

Looks like I was catching the wrong exception. This patch should behave better.

diff --git a/py3status/events.py b/py3status/events.py
index 8fb4d2b..87c1800 100644
--- a/py3status/events.py
+++ b/py3status/events.py
@@ -4,6 +4,7 @@ import sys
 from threading import Thread
 from subprocess import Popen, PIPE
 from json import loads
+from errno import EINTR

 from py3status.profiling import profile

@@ -27,7 +28,14 @@ class IOPoller:
         Try to read our I/O for 'timeout' milliseconds, return None otherwise.
         This makes calling and reading I/O non blocking !
         """
-        poll_result = self.poller.poll(timeout)
+
+        try:
+            poll_result = self.poller.poll(timeout)
+        except Exception as e:
+            if e[0] == EINTR:
+                # Interrupted system call
+                return None
+            raise (e)
         if poll_result:
             line = self.io.readline().strip()
             if self.io == sys.stdin and line == '[':
diff --git a/py3status/i3status.py b/py3status/i3status.py
index 0a2a58a..e15e2fd 100644
--- a/py3status/i3status.py
+++ b/py3status/i3status.py
@@ -330,6 +330,8 @@ class I3status(Thread):
                                 self.ready = True
                         else:
                             err = self.poller_err.readline()
+                            if not err:
+                                continue
                             code = i3status_pipe.poll()
                             if code is not None:
                                 msg = 'i3status died'

It is a shame not to be able to reproduce this error.

There has also been talk of rewriting the poller which might fix things for python 2.7

Whenever I restart, and not all the time, I got this message :
pyt3status: (error) events.py 30. Please try to fix and reload i3m

Hello @tobes, I had the same traceback as before.
From now with your latest patch, error occurs when I switch tab and refresh ith >'ctrl'+'shift'+'R'.

Tbh, this sounds like an issue with restarting i3 inplace (via $mod+Shift+r). I'm able to pick up bugs using this way after no such luck with running loop i3-msg restart every 2s in cli.

With python3.5 no error if I refresh after switching tab

No restart, no error.

This is five months old issue now. Hi there. Are you still using py3status? Are you still experiencing this bug? If yes, what modules are you running? I hope you have something new for us. We would like some update. Thanks. 馃悹

EDIT: If yes... Try running $mod+Shift+r several times too and see what you can trigger.

@amaurybrisou This issue is quite old and would be good to close. We have had a few releases since this was reported. Are you still experiencing this problem with py3status 3.5rc0?

closing due to lack of update @amaurybrisou feel free to reopen if you are still having problems with this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ertwro picture ertwro  路  4Comments

maximbaz picture maximbaz  路  6Comments

CorruptCommit picture CorruptCommit  路  5Comments

maximbaz picture maximbaz  路  8Comments

tobes picture tobes  路  4Comments