@@ -179,8 +179,8 @@ void sync_timer_wakeup(SYNC_TIMER *timer, SYNC_OBJ *obj)
179179 fe -> mbox_wsem = acl_fiber_sem_create (1 );
180180 }
181181 } else if (fe -> mbox_wsem == NULL ) {
182- msg_fatal ("%s(%d): fe's mbox_wsem NULL, out=%d" ,
183- __FUNCTION__ , __LINE__ , (int ) out );
182+ msg_fatal ("%s(%d): mbox_wsem NULL, out=%d, fd=%d, refer =%d" ,
183+ __FUNCTION__ , __LINE__ , (int ) out , fe -> fd , fe -> refer );
184184 }
185185
186186 file_event_refer (fe );
@@ -190,11 +190,29 @@ void sync_timer_wakeup(SYNC_TIMER *timer, SYNC_OBJ *obj)
190190 acl_fiber_sem_wait (fe -> mbox_wsem );
191191
192192 fe -> mask |= EVENT_SYSIO ;
193+
194+ // The fe maybe be used again in mbox_send->acl_fiber_write
195+ // ->fiber_file_open->fiber_file_get.
193196 mbox_send (timer -> box , msg );
194197
198+ #ifdef DEBUG
199+ FILE_EVENT * f = fiber_file_get (out );
200+ if (f == NULL ) {
201+ msg_fatal ("%s(%d): fiber_file_get NULL, fe=%p, out=%d" ,
202+ __FUNCTION__ , __LINE__ , fe , out );
203+ } else if (f -> mbox_wsem == NULL ) {
204+ msg_fatal ("%s(%d): mbox_wsem NULL, f=%p, fe=%p, out=%d" ,
205+ __FUNCTION__ , __LINE__ , f , fe , out );
206+ } else if (f != fe ) {
207+ msg_fatal ("%s(%d): invalid f=%p, fe=%p, out=%d" ,
208+ __FUNCTION__ , __LINE__ , f , fe , out );
209+ }
210+ #endif
211+
195212 if (acl_fiber_sem_post (fe -> mbox_wsem ) == 1 ) {
196213 fiber_file_cache_put (fe );
197214 }
215+
198216 file_event_unrefer (fe );
199217 } else {
200218 // If the current notifier is a fiber in the same thread with
0 commit comments