After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744638 - python console blocks TERM signal ... then bus errors
python console blocks TERM signal ... then bus errors
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2015-02-17 05:44 UTC by John Denker
Modified: 2015-03-30 14:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Initial patch (4.87 KB, patch)
2015-02-22 08:53 UTC, Jean Bréfort
none Details | Review
Initial patch (996 bytes, patch)
2015-02-22 08:55 UTC, Jean Bréfort
none Details | Review
enhanced patch (966 bytes, patch)
2015-02-23 14:45 UTC, Jean Bréfort
none Details | Review
Patch (1.05 KB, patch)
2015-03-11 13:30 UTC, Jean Bréfort
none Details | Review

Description John Denker 2015-02-17 05:44:32 UTC
Recipe:
  Start fresh copy of gnumeric.
  Menu --> tools --> python console
  Over in the window that started gnumeric, hit ^C^C^C^C^C^C^C^C
  Observe that has no effect.  Not good.

  In the python console window, type something, e.g. asdf <enter>
  Observe:
    CRITICAL **: gnm_py_interpreter_run_string: assertion 'stringio_module != NULL' failed

  That is immediately followed by bus error.
  All this is 100% reproducible chez moi.




gnumeric --version
gnumeric version '1.12.21'
datadir := '/usr/share/gnumeric/1.12.21'
libdir := '/usr/lib/gnumeric/1.12.21'



uname -a
Linux asclepias 3.18.0+ #2 SMP Sun Dec 21 18:25:03 MST 2014 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 Andreas J. Guelzow 2015-02-17 08:48:48 UTC
"Over in the window that started gnumeric, hit ^C^C^C^C^C^C^C^C"
Which window would that be? A terminal window? THen please file the bug against the terminal window program.
Comment 2 John Denker 2015-02-17 09:11:38 UTC
Yes, that would be a terminal window.  You know, the kind of
window where it makes sense to type ^C.

It's a bit odd that ^C behaves as expected when gnumeric
is running without the python console ... but not with.

It seems unlikely that filing a bug against xterm will
make the gnumeric bus error go away.
Comment 3 Andreas J. Guelzow 2015-02-17 09:18:34 UTC
We really should make the python console go away... That is a pieve of Gnumeric that does not get any tlc.
Comment 4 John Denker 2015-02-17 09:27:17 UTC
Also note that the terminal window plays no essential role
in the bug(s) being reported.  You can start gnumeric some
other way if you like.  You can send it SIGINT some other
way if you like.  The fact remains, it responds to the signal
in a reasonable way without the python console, but not with.

The original report suggested a terminal window because 
that is a convenient way to see the CRITICAL error and 
see the bus error.
Comment 5 Morten Welinder 2015-02-17 16:16:31 UTC
We do not block SIGTERM.  Or any other signal for that matter.

However, I have noticed that during the build process we do various
introspection tasks using tools written (by other people) in python.
These tools clearly mess with Ctrl-C.

Hence I believe this might be a python problem.
Comment 6 Jean Bréfort 2015-02-22 08:53:58 UTC
Created attachment 297557 [details] [review]
Initial patch

We might test for the signal type and only quit if it is SIGINT. Interupting with ^C and this patch results in many leaks, but I suppose it is not that important to exit properly in such a case.
Comment 7 Jean Bréfort 2015-02-22 08:55:46 UTC
Created attachment 297558 [details] [review]
Initial patch

Removed unraled changes from the patch, sorry for the noise.
Comment 8 Morten Welinder 2015-02-22 15:19:10 UTC
Will that patch make up busy-wait?
Comment 9 Jean Bréfort 2015-02-23 14:35:13 UTC
some kind of, I suppose, but it is active only when the python console is opened, and I just found it is not enough, if I close the console and type Ctrl+C in the terminal, gnumeric does not terminates, we need that when the python loader is active instead.
Comment 10 Jean Bréfort 2015-02-23 14:37:58 UTC
Confirmed, just using a ptthon function such as py_bitand eats the signals.
Comment 11 Jean Bréfort 2015-02-23 14:45:25 UTC
Created attachment 297651 [details] [review]
enhanced patch
Comment 12 Jean Bréfort 2015-02-23 14:59:36 UTC
May be we can use PySignal_SetWakeupFd() instead, but it will need more work (and may be another thread just to wait for any input).
Comment 13 Jean Bréfort 2015-02-26 13:51:46 UTC
Comment on attachment 297651 [details] [review]
enhanced patch

This is not the right thing to do, we might have several interpreters at once.
Comment 14 Jean Bréfort 2015-03-11 13:30:05 UTC
Created attachment 299096 [details] [review]
Patch
Comment 15 Jean Bréfort 2015-03-11 13:32:21 UTC
Using threads just for monitoring a signal looks worse (and not so easily portable). So I'd vote for this busy-wait solution (does something only when idle).
Comment 16 Morten Welinder 2015-03-11 13:43:12 UTC
If we're busy-waiting, can we do it with a timeout using idle priority?
Say every 100ms.
Comment 17 Jean Bréfort 2015-03-11 14:30:48 UTC
we might use:
	g_timeout_add_full (G_PRIORITY_LOW, 100, (GSourceFunc) cb_test_signals,
	                    gnm_python_obj, NULL);

That would result in a call every 100ms if and only if there is not anything else to do.
Comment 18 Jean Bréfort 2015-03-30 14:48:10 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.