Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5829 closed Bug (duplicate)

Frequent crashes when pausing torrents

Reported by: mike.dld Owned by: jordan
Priority: Normal Milestone: None Set
Component: libtransmission Version: 2.84
Severity: Major Keywords:
Cc:

Description

As reported by _n0- user on IRC, Mac client crashes quite frequently when pausing torrents. From crash report (attached) though it's evident that issue is not Mac specific and is connected to not entirely thread-safe nature of libtransmission. Crash occurs when tr_torrentStat and stopTorrent are called concurrently from different threads. To be more presize, functions in trouble are tr_peerMgrGetDesiredAvailable (called from tr_torrentStat) and replicationFree (indirectly called from stopTorrent at some point), both located in peer-mgr.c, first one accessing pieceReplication in a cycle (already after checking for it being NULL) and second one assigning NULL to it in the middle of the cycle.

Attachments (1)

Transmission_2014-11-02-003354_titan.crash (63.4 KB) - added by mike.dld 8 years ago.

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by mike.dld

comment:1 Changed 8 years ago by cfpp2p

This crash https://trac.transmissionbt.com/attachment/ticket/5407/14102.txt from #5407 appears to be an identical crash.

Attempted fix at r14111 but ticket:5407#comment:5 & #5471 ?

Other possibly related tickets #5409, #5538

For what it is worth I believe the problem began with #5294 and then the sequence of r14083 (ticket:5294#comment:1, ticket:5391#comment:12) , r14108 and r14111 but I can't follow the twisted sequence and related trac tickets.

I don't use Mac, don't get this crash and didn't find any recent crash on pause other than for Mac.

These are my observations.

comment:2 Changed 8 years ago by mike.dld

  • Resolution set to duplicate
  • Status changed from new to closed

Yeah, I'm sorry, had to search first. Closing this as duplicate and reopening #5407. As for other referenced tickets, will have to do some voodoo to decode those backtraces, but they surely look similar.

comment:3 Changed 8 years ago by x190

Possible fix ---please test:

/* count how many bytes we want that connected peers have */
uint64_t
tr_peerMgrGetDesiredAvailable (const tr_torrent * tor)
{
  size_t i;
  size_t n;
  uint64_t desiredAvailable;
  const tr_swarm * s;

  assert (tr_isTorrent (tor));

  /* common shortcuts... */

  +if (!tor->isRunning) /* Line 2615 */
  +  return 0;

  if (tr_torrentIsSeed (tor))
    return 0;


comment:4 Changed 8 years ago by x190

---

Last edited 8 years ago by x190 (previous) (diff)
Note: See TracTickets for help on using tickets.