[Pidgin] #12440: perl Purple::timeout_add multiplies calls to given subroutine (using dummy plugin code from doxygen) (was: perl Purple::timeout_add multiplites calls to given subroutine (using default plugin code from doxygen))

Pidgin trac at pidgin.im
Thu Aug 5 15:13:01 EDT 2010


#12440: perl Purple::timeout_add multiplies calls to given subroutine (using dummy
plugin code from doxygen)
-------------------------+--------------------------------------------------
 Reporter:  marcelser    |        Owner:         
     Type:  defect       |       Status:  new    
Milestone:               |    Component:  plugins
  Version:  2.7.1        |   Resolution:         
 Keywords:  plugins bug  |  
-------------------------+--------------------------------------------------
Description changed by marcelser:

Old description:

> It seems like the "timeout_add" Function in the "Purple" perl library has
> a bug. I used the "perl test plugin" from doxygen and added a timeout
> (also the code-snippet from doxygen), the plugin does nothing else then
> calling timeout_add each 5 seconds and printing a timeout message to the
> debug log. But what happens is the following:
>
> First time the timeout is reached the subroutine is called once (you see
> one "Timeout reached" line in the debug log. Then you re-enable the
> "timeout_add" function in the function itself.
>
> Seconds time the timeout is reached the subroutine is called twice (two
> log linges), re-enable again
>
> Third time the timeout is reached the subroutine is called four times
> (four log lines)
>
> and so on...
>
> The calls to the timeout function always duplicate themselves and at a
> certain point pidgin hangs (especially if you decrease the timeout value
> even more). I didn't find a solution to this problem, if you don't re-
> enable the timeout nothing happens after timeout is reached (like the
> documentation states its only called once), but if you re-enable it the
> number of calls are duplicated on every timeout.
>
> I've attached the "perl test plugin" from doxygen with the timeout code
> snippet also from doxygen. Just enable the plugin and watch the debug
> log.

New description:

 It seems like the "timeout_add" Function in the "Purple" perl library has
 a bug. I used the "perl test plugin" from doxygen and added a timeout (the
 code-snippet I added is also from doxygen). The plugin does nothing else
 then calling timeout_add every 5 seconds and printing a timeout message to
 the debug log. But what happens is the following:

 First time the timeout is reached the subroutine is called once (you see
 one "Timeout reached" line in the debug log). Then you re-enable the
 "timeout_add" function in the function itself.

 Second time the timeout is reached the subroutine is called twice (two log
 linges), re-enable again

 Third time the timeout is reached the subroutine is called four times
 (four log lines), re-enable

 next cycle is 8 calls to subroutine, then 16 and so on.

 so the number of calls always multiply by 2 and this causes a lot of calls
 after a few timeout cycles. After a certain amount of calls is reached
 pidgin hangs I guess because I can no longer handle the numer of calls. I
 tried not to re-enable the function but then it behaves like it should
 because it's only executed once and no more. I've found no workaround so
 perl plugins with timeouts can not be written at the moment.

 I've attached the "perl test plugin" from doxygen with the timeout code
 snippet also from doxygen. Just enable the plugin and watch the debug log,
 you'll see the log-lines multiply.

--

-- 
Ticket URL: <http://developer.pidgin.im/ticket/12440#comment:1>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list