Kleopatra: Hang in gpgconf_read on posix with GPGME_DEBUG=9
Open, NormalPublic

Description

Noticed while testing Kleopatra does repeatedly not start for me. This is the first time I'm seeing this.

Sometimes it starts but often times it hangs. Strace shows a read while it is hanging.
Version gpgme-1.11.2-beta247 gpg 2.2.9-beta11

Strangely enough t-gpgconf works without a problem even if I run it 1000 times. Maybe something with gpgme++? Looking into it.

Attaching GDB resulted in the following backtrace:

(gdb) bt full
#0  0x00007f1bd6fcb20d in read () at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x00007f1bd6da6bb5 in _gpgme_ath_read (fd=<optimized out>, buf=<optimized out>, nbytes=<optimized out>)
    at ../../../src/gpgme/src/ath.c:84
No locals.
#2  0x00007f1bd6da0d08 in _gpgme_io_read (fd=22, buffer=buffer@entry=0x55d2d45f1300, count=count@entry=1023)
    at ../../../src/gpgme/src/posix-io.c:116
        nread = <optimized out>
        _gpgme_trace_func = 0x7f1bd6dabd7f "_gpgme_io_read"
        _gpgme_trace_tagname = 0x7f1bd6daa625 "fd"
        _gpgme_trace_tag = 0x16
#3  0x00007f1bd6d9ab97 in gpgconf_read (engine=engine@entry=0x55d2d45f08c0, 
    arg1=arg1@entry=0x7f1bd6daa491 "--list-options", arg2=<optimized out>, 
    cb=cb@entry=0x7f1bd6d9be40 <gpgconf_config_load_cb2>, hook=hook@entry=0x55d2d45ea350)
    at ../../../src/gpgme/src/engine-gpgconf.c:275
        gpgconf = 0x55d2d45f08c0
        err = 0
        linebuf = 0x55d2d45f1300 "X\v<\324\033\177"
        linebufsize = <optimized out>
        linelen = 0
        argv = {0x55d2d45f08e0 "/opt/gnupg/bin/gpgconf", 0x7f1bd6daa491 "--list-options", 0x55d2d45f1710 "gpg", 
          0x0, 0x20 <error: Cannot access memory at address 0x20>, 0x0}
        argc = <optimized out>
        rp = {22, 23}
        cfd = {{fd = 23, dup_to = 1, peer_name = 23, arg_loc = 0}, {fd = -1, dup_to = -1, peer_name = 0, 
            arg_loc = 0}}
        status = <optimized out>
        nread = <optimized out>
        mark = <optimized out>
#4  0x00007f1bd6d9ae3e in gpgconf_conf_load (engine=0x55d2d45f08c0, comp_p=0x7fff9ce82c58)
    at ../../../src/gpgme/src/engine-gpgconf.c:582
        err = 0
        comp = 0x55d2d45ea350
        cur_comp = 0x55d2d45ea350
#5  0x00007f1bd6da03f4 in gpgme_op_conf_load (ctx=0x55d2d45f0610, conf_p=conf_p@entry=0x7fff9ce82c58)
    at ../../../src/gpgme/src/gpgconf.c:85
        err = <optimized out>
        proto = GPGME_PROTOCOL_OpenPGP
#6  0x00007f1bd724e46a in GpgME::Configuration::Component::load (returnedError=...)
    at ../../../../../src/gpgme/lang/cpp/src/configuration.cpp:78
        err = <optimized out>
        ctx_native = 0x55d2d45f0610
        ctx = std::shared_ptr (count 1, weak 0) 0x0
        conf_list_native = 0x0
        head = <optimized out>
aheinecke renamed this task from Kleopatra: Hang in gpgconf_read on posix to Kleopatra: Hang in gpgconf_read on posix with GPGME_DEBUG=9.Aug 30 2018, 10:50 AM
aheinecke lowered the priority of this task from High to Normal.

This happens only if GPGME_DEBUG is set to 9 which was accidentally set in my environment. So I've lowered the priority.

Buit even with that set I can't reproduce it without Kleopatra.