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

setenv()/putenv() are not thread-safe #432

Closed
wcasanova opened this issue Mar 2, 2020 · 20 comments
Closed

setenv()/putenv() are not thread-safe #432

wcasanova opened this issue Mar 2, 2020 · 20 comments
Labels
dependency Dependency on various other libraries

Comments

@wcasanova
Copy link

wcasanova commented Mar 2, 2020

Describe the bug
When starting a connection, give the following warning
GLib-LOG **: setenv()/putenv() are not thread-safe and should not be used after threads are created at /usr/lib/perl5/5.30/vendor_perl/Glib/Object/Introspection.pm line 67. GLib-LOG **: setenv()/putenv() are not thread-safe and should not be used after threads are created at /usr/lib/perl5/5.30/vendor_perl/Glib/Object/Introspection.pm line 67. GLib-LOG **: unsetenv() is not thread-safe and should not be used after threads are created at /usr/share/perl5/vendor_perl/Gtk3.pm line 555.

Desktop (please complete the following information):

  • OS: Archlinux
  • Version : loki 4423929
@gfrenoy
Copy link
Contributor

gfrenoy commented Mar 3, 2020

Thanks for the feedback.

I do believe that it does not really hurt. I mean: it was already the case for a long time, the upstream projects decided to display a warning since the newer version, this is a very good piece of information :-)

At this stage, I'm not yet sure if this is something needs to be fixed in Ásbrú or in Gtk / Gtk-perl or Glib-introspection or maybe somewhere else !

If somebody has a better understanding of these new warnings, please let use now.

@panciom
Copy link

panciom commented Mar 13, 2020

Hi to all.
I confirm this "bug" on Debian Experimental.

GLib-LOG **: setenv()/putenv() are not thread-safe and should not be used after threads are created at /usr/lib/x86_64-linux-gnu/perl5/5.30/Glib/Object/Introspection.pm line 67.
GLib-LOG **: setenv()/putenv() are not thread-safe and should not be used after threads are created at /usr/lib/x86_64-linux-gnu/perl5/5.30/Glib/Object/Introspection.pm line 67.
GLib-LOG **: unsetenv() is not thread-safe and should not be used after threads are created at /usr/share/perl5/Gtk3.pm line 555.

It seems to work good anyway.

Thanks to all.
Mirko

@beliys
Copy link
Contributor

beliys commented Mar 25, 2020

Is there any way to hide these warnings?

@demirdag
Copy link

demirdag commented Apr 6, 2020

Hiding the warnings/errors would also be acceptable for me. The errors and warnings just clutter up the terminal window. That is actually my complaint...

@gfrenoy
Copy link
Contributor

gfrenoy commented Apr 15, 2020

Fyi, I created an issue to the upstream project (Gtk3-perl) : https://gitlab.gnome.org/GNOME/perl-gtk3/-/issues/7

@gfrenoy
Copy link
Contributor

gfrenoy commented Apr 15, 2020

Some notes while searching...

Message has been added recently in glib --> https://gitlab.gnome.org/GNOME/glib/-/blob/master/NEWS#L114-115

Related merge request : https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1337

A very minimal code to reproduce the error is:

use Glib::Object::Introspection;
use Gtk3 -init;

Glib::Object::Introspection->setup(basename => 'Gio',
                                   version => '2.0',
                                   package => 'Glib::IO');

my $app = Gtk3::Application->new('test.test', []);
$app->register();

Added line:

print("Invoke $basename $namespace $name @_\n");

on line 67 of /usr/lib/x86_64-linux-gnu/perl5/5.30/Glib/Object/Introspection.pm and ran the minimal code with gdb (gdb --args perl test.pl), this shows:

Starting program: /usr/bin/perl test.pl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff49de700 (LWP 29651)]
[New Thread 0x7ffff41dd700 (LWP 29652)]
Invoke Gtk Application new Gtk3::Application test.test ARRAY(0x5555558ae470)
Invoke Gio Application register Gtk3::Application=HASH(0x555556cfcdc0)
GLib-LOG **: unsetenv() is not thread-safe and should not be used after threads are created at /usr/lib/x86_64-linux-gnu/perl5/5.30/Glib/Object/Introspection.pm line 68.
[Thread 0x7ffff41dd700 (LWP 29652) exited]
[Thread 0x7ffff49de700 (LWP 29651) exited]
[Inferior 1 (process 29646) exited normally]

So the message looks to be generated in to Gio application register.

Code of Gio application register can be found here https://gitlab.gnome.org/GNOME/glib/-/blob/master/gio/gapplication.c#L2175-2214

I don't see any obvious reference to the environment there...

A (hopefully) similar application in python does not generate the same kind of warning:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import sys

class MyApplication(Gtk.Application):

    def __init__(self):
        Gtk.Application.__init__(self)

    def do_activate(self):
        print("activated")


app = MyApplication()
if (app.register()):
    print("registered")
exit_status = app.run(sys.argv)
sys.exit(exit_status)

@master-vineet
Copy link

Tunneling issue with windows system asking password even password is saved already and if we enter the password again then it shows wrong password and try again option.

This is with Focal Fosa Ubuntu 20.04

GLib-LOG **: setenv()/putenv() are not thread-safe and should not be used after threads are created at /usr/lib/x86_64-linux-gnu/perl5/5.30/Glib/Object/Introspection.pm line 67.
GLib-LOG **: setenv()/putenv() are not thread-safe and should not be used after threads are created at /usr/lib/x86_64-linux-gnu/perl5/5.30/Glib/Object/Introspection.pm line 67.
GLib-LOG **: unsetenv() is not thread-safe and should not be used after threads are created at /usr/share/perl5/Gtk3.pm line 555.
-------------

                                         W A R N I N G 

                                         ------------- 

THIS IS A PRIVATE COMPUTER SYSTEM.

This is an official computer system and the property of One97 Communications Ltd. and It is for authorized users only. Unauthorized users are prohibited. Users (authorized or unauthorized) have no explicit or implicit expectation of privacy. Any or all uses of this system may be subject to one or more of the following actions: interception, monitoring, auditing, inspection and disclosing to security personnel and law enforcement personnel, as well as authorized officials of other agencies, both domestic and foreign. By using this system, the user consents to these actions. Unauthorized or improper use of this system may result in administrative disciplinary action and civil and criminal penalties. By accessing this system you indicate your awareness of and consent to these terms and conditions of use. Discontinue access immediately if you do not agree to the conditions stated in this notice.
Administrator@localhost's password:
Permission denied, please try again.
Administrator@localhost's password: LOG **: Name com.canonical.AppMenu.Registrar does not exist on the session bus

Permission denied, please try again.
Administrator@localhost's password:
Administrator@localhost: Permission denied (publickey,password).

@gfrenoy
Copy link
Contributor

gfrenoy commented Apr 30, 2020

@master-vineet please avoid posting the same issue everywhere and stay on topic. Your issue does not seem related to setenv/putenv. As already suggest, please check your password prompt in advanced settings or create a dedicated issue.

@gfrenoy
Copy link
Contributor

gfrenoy commented May 20, 2020

Good news : it looks like the root issue has been identified ! The guilty one is perl-glib that is reporting a debug message, even if the appropriate debug flag is not set.

And a patch is now available, see https://gitlab.gnome.org/GNOME/perl-glib/-/merge_requests/5

Is there anyone to check if it works ?

@bitchecker
Copy link
Contributor

When starting a connection, give the following warning

GLib-LOG **: setenv()/putenv() are not thread-safe and should not be used after threads are created at /usr/lib/perl5/5.30/vendor_perl/Glib/Object/Introspection.pm line 67.
GLib-LOG **: setenv()/putenv() are not thread-safe and should not be used after threads are created at /usr/lib/perl5/5.30/vendor_perl/Glib/Object/Introspection.pm line 67.
GLib-LOG **: unsetenv() is not thread-safe and should not be used after threads are created at /usr/share/perl5/vendor_perl/Gtk3.pm line 555.

Confirmed bug/issue on Fedora 32

@MiltonLai
Copy link

Thanks for the fix. It is really confusing when I first saw these warnings.

@gfrenoy
Copy link
Contributor

gfrenoy commented Jun 2, 2020

Yes confusing and very annoying ; we'll need to wait for the next release of the upstream perl-Gtk3 package to have it fixed for everyone.

In the meantime, you can use a locally compiled version of that package by doing something like:

git clone https://gitlab.gnome.org/GNOME/perl-glib.git
cd perl-glib.git
perl Makefile.PL PREFIX=/some/local/lib/location
make
make install

and then you can run Ásbrú with that local library with something like:

export PERL5LIB=/some/local/lib/location/perl5/lib/x86_64-linux-gnu/perl/5.30.0:$PERL5LIB
asbru-cm

@gfrenoy
Copy link
Contributor

gfrenoy commented Jun 6, 2020

Fyi, a new step has been made in the right direction, see https://mail.gnome.org/archives/gtk-perl-list/2020-June/msg00002.html where you'll read the announcement of the new perl-glib package (version 1.3293) that includes the necessary fix.

Next step is to have to included in the various distributions ; please contact the packagers if needed...

@gfrenoy gfrenoy added dependency Dependency on various other libraries and removed help wanted labels Jun 6, 2020
@figue
Copy link
Contributor

figue commented Jun 13, 2020

Fixed in Archlinux with glib-perl 1.3293. Hope it will be soon in official repos.

@wcasanova
Copy link
Author

I confirm, that updating to glib-perl 1.3293, it is resolved.

@hanspr
Copy link
Contributor

hanspr commented Jul 10, 2020

If you do not want to wait for an official release

guess will work for similar debian distributions, tested on Linux Mint 20

install with synaptics: libglib2.0-dev

or

sudo apt install libglib2.0-dev

then

sudo cpanm -i Glib

You should see a message similar to

--> Working on Glib
Fetching http://www.cpan.org/authors/id/X/XA/XAOC/Glib-1.3293.tar.gz ... OK
Configuring Glib-1.3293 ... OK
Building and testing Glib-1.3293 ... OK
Successfully installed Glib-1.3293 (upgraded from 1.3292)
1 distribution installed

@psyray
Copy link

psyray commented Oct 1, 2020

@hanspr
Thanks for the fix.
For me i have had also to install cpanminus package

apt install cpanminus

Now everything is fine 👍

@vinsgithub
Copy link

Tested on Ubuntu 20.04.2 LTS:

sudo apt install cpanminus
sudo cpanm -i Glib

solved the problem.
thanks @hanspr and @psyray !

@gfrenoy
Copy link
Contributor

gfrenoy commented Feb 16, 2021

To summarize: the fix is available in glib-perl 1.3293, distribution has to integrate it or you have to install it manually (see instructions above). We can close this issue in Ásbrú.

@gfrenoy gfrenoy closed this as completed Feb 16, 2021
@iamkarshe
Copy link

If sudo cpanm -i Glib fails, pl run sudo apt-get install libglib2.0-dev to install missing dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Dependency on various other libraries
Projects
None yet
Development

No branches or pull requests