Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1368353 - [NMCI] [abrt] [faf] NetworkManager: g_object_get_property(): /usr/bin/nmcli killed by 11
[NMCI] [abrt] [faf] NetworkManager: g_object_get_property(): /usr/bin/nmcli k...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Beniamino Galvani
Desktop QE
http://faf.lab.eng.brq.redhat.com/faf...
:
: 1374635 1379816 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-19 03:25 EDT by Vladimir Benes
Modified: 2017-08-01 05:17 EDT (History)
8 users (show)

See Also:
Fixed In Version: NetworkManager-1.8.0-0.2.git20170215.1d40c5f4.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-01 05:17:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
GNOME Bugzilla 732097 None None None 2016-09-05 13:48 EDT
Red Hat Product Errata RHSA-2017:2299 normal SHIPPED_LIVE Moderate: NetworkManager and libnl3 security, bug fix and enhancement update 2017-08-01 08:40:28 EDT

  None (edit)
Description Vladimir Benes 2016-08-19 03:25:45 EDT
This bug has been created based on an anonymous crash report requested by the package maintainer.

Report URL: http://faf.lab.eng.brq.redhat.com/faf/reports/bthash/ea8d063089884094ab7de7a2158c22b74aec82ba/
Comment 1 Thomas Haller 2016-08-19 08:31:01 EDT
no idea why this would happen...

assigning to bgalvani :)
Comment 2 Beniamino Galvani 2016-08-19 10:13:57 EDT
The crash happens when editing a connection with the 'nmcli connection
edit', apparently because the @g_class field of a connection object is
invalid in g_object_get_property().

I suspect this is caused by a race condition since the editor runs in
its own thread different from the main thread of the GMainLoop, and
GObjects are not thread-safe.

I think the reason why the thread was added was to allow the use of
readline() without blocking the processing of D-Bus events; but I'm
not sure if this is safe since there is the possibility that the two
threads access the same object concurrently.

A possible fix would be to move the editor loop back to the main
thread and switch to the readline alternate interface [1], which
allows asynchronous operation.

[1] https://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC41
Comment 3 Thomas Haller 2016-08-20 03:34:50 EDT
(In reply to Beniamino Galvani from comment #2)

> I suspect this is caused by a race condition 

yeah, that sounds plausible (cannot say for sure).

But surely, the editor thread is a bug and unexpected crashes may happen in edit mode.
Comment 4 Beniamino Galvani 2016-09-03 05:25:13 EDT
Pushed branch bg/cli-readline-async-rh1368353 for review.
Comment 5 Thomas Haller 2016-09-05 13:48:05 EDT
(In reply to Beniamino Galvani from comment #4)
> Pushed branch bg/cli-readline-async-rh1368353 for review.

please refer in the commit message to https://bugzilla.gnome.org/show_bug.cgi?id=732097


          if (nmc_get_in_readline ()) {
+              g_print ("^C\n");

can we not print anything and just wrap the line?

For the terminal, this is configurable via `stty -ctlecho`. It seems, we should not print this ourself.




     /* Add string to the history */
+    if (rl_string && *rl_string)
+         add_history (rl_string);

I think, if the user pressed CTRL+C, we should add the command to the history.




let's drop nmc_set_in_readline() and have "g_return_val_if_fail (!in_readline, NULL);" at the preample of nmc_readline_helper().



I think signal_handler() must be async-signal-safe. g_message() is not allowed. 
I think g_unix_signal_add() is better.


g_message() and other g_log() functions are not suitable inside nmcli, because they print a prefix and the logging severity. g_print() or g_printerr() should be used -- or better a wrapper like nmcli_print().
Comment 6 Beniamino Galvani 2016-09-09 16:51:15 EDT
(In reply to Thomas Haller from comment #5)
> (In reply to Beniamino Galvani from comment #4)
> > Pushed branch bg/cli-readline-async-rh1368353 for review.
> 
> please refer in the commit message to
> https://bugzilla.gnome.org/show_bug.cgi?id=732097

ok


>           if (nmc_get_in_readline ()) {
> +              g_print ("^C\n");
> 
> can we not print anything and just wrap the line?
> 
> For the terminal, this is configurable via `stty -ctlecho`. It seems, we
> should not print this ourself.

Mmh, doesn't seem to work with readline. I've restored the old way to print the ^C using "rl_echo_signal_char (SIGINT)".


>      /* Add string to the history */
> +    if (rl_string && *rl_string)
> +         add_history (rl_string);
> 
> I think, if the user pressed CTRL+C, we should add the command to the
> history.

Fixed.

> let's drop nmc_set_in_readline() and have "g_return_val_if_fail
> (!in_readline, NULL);" at the preample of nmc_readline_helper().

nmc_set_in_readline() is still needed to recognize whether SIGINT happens during a readline or not.

> I think signal_handler() must be async-signal-safe. g_message() is not
> allowed. 
> I think g_unix_signal_add() is better.

Fixed.

> g_message() and other g_log() functions are not suitable inside nmcli,
> because they print a prefix and the logging severity. g_print() or
> g_printerr() should be used -- or better a wrapper like nmcli_print().

Fine.

Repushed branch bg/cli-readline-async-rh1368353.
Comment 7 Thomas Haller 2016-09-11 15:28:14 EDT
lgtm now
Comment 8 Thomas Haller 2016-09-12 04:52:35 EDT
*** Bug 1374635 has been marked as a duplicate of this bug. ***
Comment 9 Francesco Giudici 2016-09-22 13:03:54 EDT
lgtm
Comment 11 Beniamino Galvani 2016-09-27 17:04:00 EDT
*** Bug 1379816 has been marked as a duplicate of this bug. ***
Comment 13 errata-xmlrpc 2017-08-01 05:17:07 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2299

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