#1646 closed defect (fixed)
Deadlock and crash problem in transaction related to transport
Reported by: | bennylp | Owned by: | bennylp |
---|---|---|---|
Priority: | normal | Milestone: | release-2.2 |
Component: | pjsip | Version: | trunk |
Keywords: | Cc: | ||
Backport to 1.x milestone: | Backported: | no |
Description
Two problems are covered by this ticket:
1. Deadlock in transport disconnection notification
TCP and TLS transport disconnection will notify transaction by calling tsx_tp_state_callback(). Unfortunately this causes deadlock with at least two scenarios below:
- Deadlock between transport mutex and transaction group lock:
- thread 1: tsx sending a message. It is holding transaction group lock and acquiring transport mutex.
- thread 2: disconnection event from transport. Thread is holding transport mutex and acquiring transaction group lock
- Deadlock between transaction group lock and dialog mutex
- thread 1: dialog sending message. It is holding dialog mutex and acquiring transaction group lock.
- thread 2: a network operation on different transaction caused disconnection event to be triggered and transport is notifying transaction. Thread is holding transaction mutex and is acquiring dialog lock to notify dialog.
2. Crash because transaction is destroyed prematurely while sending is in progress
When network is congested, sending operation will be queued and later a completion callback in the transaction will be called. If transaction is destroyed (for example due to transport disconnection or transaction timeout) while the sending operation is in progress, a crash will occur later when the pending send operation completes.
Change History (4)
comment:1 Changed 12 years ago by bennylp
comment:2 Changed 12 years ago by bennylp
- Resolution set to fixed
- Status changed from new to closed
In 4446:
comment:3 Changed 12 years ago by bennylp
In 4448:
comment:4 Changed 11 years ago by nanang
- Component changed from applications to pjsip
- Milestone set to release-2.2
In 4444: