Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-49059

qEnvironmentVariableIsEmpty sigbus,sigsegv

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.0.2
    • None
    • 12.04.5 LTS : 5.0.2 (SIGBUS) & Ubuntu 15.04 : 5.4.1 (SIGSEGV)

    Description

      Greetings,

      I'm experiencing a seg fault like so,

          mock processing on: 18
          mock processing on: 19
          mock processing on: 20
          [Thread 0x7ffff341a700 (LWP 29295) exited]
          [New Thread 0x7ffff341a700 (LWP 29343)]
          Program received signal SIGSEGV, Segmentation fault.
          __GI_getenv (name=0x7ffff6d522a5 "CALDOMAIN", name@entry=0x7ffff6d522a3 "LOCALDOMAIN") at getenv.c:85
          85  getenv.c: No such file or directory.
          (gdb) bt
          #0  __GI_getenv (name=0x7ffff6d522a5 "CALDOMAIN", name@entry=0x7ffff6d522a3 "LOCALDOMAIN") at getenv.c:85
          #1  0x00007ffff6ce9c54 in __res_vinit (statp=0x7ffff6f8bfc0 <_res>, preinit=<optimized out>) at res_init.c:198
          #2  0x00007ffff7f31a30 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Network.so.5
          #3  0x00007ffff7f25791 in QHostInfo::fromName(QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Network.so.5
          #4  0x00007ffff7f475d8 in QAbstractSocket::waitForConnected(int) () from /usr/lib/x86_64-linux-gnu/libQt5Network.so.5
          #5  0x0000000000405078 in SQS::get (this=0x7fffffffdac0) at src/SQS.cpp:145
          #6  0x000000000040248f in main (argc=1, argv=0x7fffffffde28) at src/main.cpp:43
      

      From this code,

      	QTcpSocket socket;
      	socket.connectToHost(awsHost, 80);
      
      	if (socket.waitForConnected(5000))
      	{
      		socket.write(buffer);
      		socket.waitForBytesWritten(60000);
      		socket.waitForReadyRead(5000);
          ...
      

      This code is called repeatedly, pretty quickly; it looks like a thread exited, and when i resumed processing its spun a new thread and immediately SIGSEGV

      The exception is a little different on my work computer:

          mock processing on: 1
          mock processing on: 1
          [New Thread 0x7ffff39d5700 (LWP 26323)]
          Program received signal SIGBUS, Bus error.
          [Switching to Thread 0x7ffff39d5700 (LWP 26323)]
          __GI_getenv (name=0x7ffff7331eb1 "_NO_GLIB") at getenv.c:90
          (gdb) bt
          #0  __GI_getenv (name=0x7ffff7331eb1 "_NO_GLIB") at getenv.c:90
          #1  0x00007ffff7101cb9 in qEnvironmentVariableIsEmpty(char const*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
          #2  0x00007ffff7111cb5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
          #3  0x00007ffff7112a96 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
          #4  0x00007ffff6182e9a in start_thread (arg=0x7ffff39d5700) at pthread_create.c:308
          #5  0x00007ffff68a638d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
          #6  0x0000000000000000 in ?? ()
      

      same function, different ENV variable is being checked – i've been searching getenv crashes on google, seems could be threading/race related; i think this is the jist of the function:

          const char * const value = ::getenv(varName);
          return !value || !*value;
      

      while this code involves the network code i ponder if its a greater issue with qEnvironmentVariableIsEmpty in general?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            sumar Arni Sumarlidason
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes