@@ -279,7 +279,7 @@ const LOOPER_WAITING_PROC: u32 = 0x20;
279279const LOOPER_POLL : u32 = 0x40 ;
280280
281281impl InnerThread {
282- fn new ( ) -> Result < Self > {
282+ fn new ( pid : i32 ) -> Result < Self > {
283283 fn next_err_id ( ) -> u32 {
284284 static EE_ID : Atomic < u32 > = Atomic :: new ( 0 ) ;
285285 EE_ID . fetch_add ( 1 , Relaxed )
@@ -290,8 +290,8 @@ impl InnerThread {
290290 looper_need_return : false ,
291291 is_dead : false ,
292292 process_work_list : false ,
293- reply_work : ThreadError :: try_new ( ) ?,
294- return_work : ThreadError :: try_new ( ) ?,
293+ reply_work : ThreadError :: try_new ( pid ) ?,
294+ return_work : ThreadError :: try_new ( pid ) ?,
295295 work_list : List :: new ( ) ,
296296 current_transaction : None ,
297297 extended_error : ExtendedError :: new ( next_err_id ( ) , BR_OK , 0 ) ,
@@ -445,7 +445,7 @@ kernel::list::impl_list_item! {
445445
446446impl Thread {
447447 pub ( crate ) fn new ( id : i32 , process : Arc < Process > ) -> Result < Arc < Self > > {
448- let inner = InnerThread :: new ( ) ?;
448+ let inner = InnerThread :: new ( process . task . pid ( ) ) ?;
449449
450450 Arc :: pin_init (
451451 try_pin_init ! ( Thread {
@@ -1108,6 +1108,12 @@ impl Thread {
11081108 let mut inner = thread. inner . lock ( ) ;
11091109 inner. pop_transaction_to_reply ( thread. as_ref ( ) )
11101110 } {
1111+ binder_debug ! (
1112+ DeadTransaction ,
1113+ "release transaction {} in, still active" ,
1114+ transaction. debug_id
1115+ ) ;
1116+
11111117 let reply = Err ( BR_DEAD_REPLY ) ;
11121118 if !transaction. from . deliver_single_reply ( reply, & transaction) {
11131119 break ;
@@ -1284,7 +1290,10 @@ impl Thread {
12841290 // TODO: We need to ensure that there isn't a pending transaction in the work queue. How
12851291 // could this happen?
12861292 let top = self . top_of_transaction_stack ( ) ?;
1287- let list_completion = DTRWrap :: arc_try_new ( DeliverCode :: new ( BR_TRANSACTION_COMPLETE ) ) ?;
1293+ let list_completion = DTRWrap :: arc_try_new ( DeliverCode :: new (
1294+ BR_TRANSACTION_COMPLETE ,
1295+ self . process . task . pid ( ) ,
1296+ ) ) ?;
12881297 let completion = list_completion. clone_arc ( ) ;
12891298 let transaction = Transaction :: new ( node_ref, top, self , info) ?;
12901299
@@ -1336,7 +1345,10 @@ impl Thread {
13361345
13371346 // We need to complete the transaction even if we cannot complete building the reply.
13381347 let out = ( || -> BinderResult < _ > {
1339- let completion = DTRWrap :: arc_try_new ( DeliverCode :: new ( BR_TRANSACTION_COMPLETE ) ) ?;
1348+ let completion = DTRWrap :: arc_try_new ( DeliverCode :: new (
1349+ BR_TRANSACTION_COMPLETE ,
1350+ self . process . task . pid ( ) ,
1351+ ) ) ?;
13401352 let process = orig. from . process . clone ( ) ;
13411353 let allow_fds = orig. flags & TF_ACCEPT_FDS != 0 ;
13421354 let reply = Transaction :: new_reply ( self , process, info, allow_fds) ?;
@@ -1370,7 +1382,8 @@ impl Thread {
13701382 } else {
13711383 BR_TRANSACTION_COMPLETE
13721384 } ;
1373- let list_completion = DTRWrap :: arc_try_new ( DeliverCode :: new ( code) ) ?;
1385+ let list_completion =
1386+ DTRWrap :: arc_try_new ( DeliverCode :: new ( code, self . process . task . pid ( ) ) ) ?;
13741387 let completion = list_completion. clone_arc ( ) ;
13751388 self . inner . lock ( ) . push_work ( list_completion) ;
13761389 match transaction. submit ( info) {
@@ -1626,14 +1639,16 @@ impl Thread {
16261639#[ pin_data]
16271640struct ThreadError {
16281641 error_code : Atomic < u32 > ,
1642+ pid : i32 ,
16291643 #[ pin]
16301644 links_track : AtomicTracker ,
16311645}
16321646
16331647impl ThreadError {
1634- fn try_new ( ) -> Result < DArc < Self > > {
1648+ fn try_new ( pid : i32 ) -> Result < DArc < Self > > {
16351649 DTRWrap :: arc_pin_init ( pin_init ! ( Self {
16361650 error_code: Atomic :: new( BR_OK ) ,
1651+ pid,
16371652 links_track <- AtomicTracker :: new( ) ,
16381653 } ) )
16391654 . map ( ListArc :: into_arc)
@@ -1660,7 +1675,16 @@ impl DeliverToRead for ThreadError {
16601675 Ok ( true )
16611676 }
16621677
1663- fn cancel ( self : DArc < Self > ) { }
1678+ fn cancel ( self : DArc < Self > ) {
1679+ let code = self . error_code . load ( Relaxed ) ;
1680+ if code != BR_OK {
1681+ binder_debug ! (
1682+ pid = self . pid,
1683+ DeadTransaction ,
1684+ "undelivered TRANSACTION_ERROR: {code}"
1685+ ) ;
1686+ }
1687+ }
16641688
16651689 fn should_sync_wakeup ( & self ) -> bool {
16661690 false
0 commit comments