https://bugs.kde.org/show_bug.cgi?id=501713

--- Comment #3 from zephyrus00jp <ishik...@yk.rim.or.jp> ---
(In reply to Paul Floyd from comment #2)
> (In reply to zephyrus00jp from comment #1)
> 
> > So maybe newer versions of valgrind has issue(s) [maybe it does not handle
> > thread sync related primtives correctly? Maybe hellgrind does and memcheck
> > forgets to handle some primitives?].
> > Or thunderbird does something wrong which firefox gets right.
> 
> I don't see anything concrete here that indicates a bug in Valgrind.
> Memcheck has detected a conditional read error. I strongly suggest that you
> take memcheck's word that there is an error and don't start making random
> guesses about other causes.
> 
> It is possible that the change in scheduling that you get when running under
> Valgrind is revealing an underlying bug in the guest code. That's still a
> guest issue. The Valgrind core has to do some hacky things so that newly
> spawned threads also run under Valgrind. Memcheck doesn't do anything else
> with thread primitives. DRD and Helgrind intercept pthread functions so that
> they an validate and record the thread state. The intercepts still call the
> intercepted pthread functions.
> 
> In order to see where the error is try using vgdb. You will need 2
> terminals, one with valgrind and the other with gdb. When you hit the error
> you can use the memcheck monitor commands to see which part of the 'if'
> expression is uninitialized.

The uninitialized value is |rv|.
https://searchfox.org/comm-central/source/mailnews/imap/src/nsImapProtocol.cpp#1281

```
**
 * Dispatch socket thread to to determine if connection is alive.
 */
nsresult nsImapProtocol::IsTransportAlive(bool* alive) {
  nsresult rv;  <------------- THIS is declared without an initialization.
  auto GetIsAlive = [transport = nsCOMPtr{m_transport}, &rv, alive]() mutable {
    rv = transport->IsAlive(alive);   <-------------- |rv| is supposed to get
set in this lambda.
  };
  nsCOMPtr<nsIEventTarget> socketThread(
      do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID));
  if (socketThread) {
    mozilla::SyncRunnable::DispatchToThread(
        socketThread,
        NS_NewRunnableFunction("nsImapProtocol::IsTransportAlive",
GetIsAlive));  <--- calling thread does not stop here to wait for
                                                              lambda
(GetIsAlive), and proceeds.
  } else {
    rv = NS_ERROR_NOT_AVAILABLE;
  }
  return rv;  <--- Thus, this |rv| returns an uninitialized value since
GetIsAlive has not been executed. 
```

The above is what I found.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to