Dirk Meyer wrote:
> Duncan Webb wrote:
>> Tanja said the following, on 28.02.2008 23:29:
>>> Hi Duncan,
>>>
>>>   
>>>> What I did is to add two prints before and after the Popen in 
>>>> childapp.py and noticed that the first one was printed but not the 
>>>> second one nor any other message after. 
>>>>     
>>> That is what I have expected from what I see in the logs...
> 
> Without remembering the code in Freevo 1.x, maybe you can use
> kaa.Process as a wrapper for popen.

I could do, but I'm trying to keep rel-1 and rel-1-7 in sync as much as 
possible.

>>>> The recordserver does not shut down, needs a kill -9.
>>> What do you mean by that?
>>> With the current svn version "freevo recordserver stop"
>>> stops the recordserver without any problems.
>>> And also a CTRL-C is working as expected...
>>>   
>> I've noticed that it sometimes works and sometimes doesn't, I think that
>> it doesn't work after a recording but does before.
> 
> That is something we need to hunt down. You do not use twisted, right?

Not any more, just kaa.main.run, kaa.AtTimer and kaa.rpc. (the only 
twisted code is sux from twisted.web which is used by the jelly code.

> You use the nornal notifier mainloop. In that case, C-c sends a
> sys.exit to the mainloop. The question is, what happens? Do you catch
> all exceptions somewhere? In that case the exit will get lost.

I have this in __main__, so I would expect the Ctrl-C exit (basically 
the stop command) to print something.
|try:
|    main()
|except Exception, why:
|    traceback.print_exc()
|    print why
|print 'done.'

> 
>> No I don't think so, it seems to be more related to using DirectFB
>> framebuffers rather than X. I was having problems with shutting down
>> before I started with this set of changes. Trouble is that sometimes it
>> does shutdown cleanly.
> 
> Maybe the dfb code is doing something bad. But the recordserver should
> use neither X nor dfb.

There are two problems freevo shutting down and the recordserver 
shutting down, DirectFB is for freevo.

I suspect that the problem lies with kaa.rpc / async, it seems that once 
an rpc calls has been made freevo won't shut down any more. The log 
shows that there are a lot of channels opened but not closed.

So what is the criteria that determines when a new channel is opened and 
an existing channel is closed.

I put a traceback in the signal handler, it seems to be called twice in 
quick succession. Adding a global shutting down flag stops the 
re-entrance but doesn't help.

Here it works:

DJW:Starting kaa main run loop
DJW:shutdown(exit=True)
DJW:shutdown(exit=True)
   File "/usr/lib/python2.4/site-packages/freevo/main.py", line 478, in ?
     kaa.main.run()
   File "/usr/lib/python2.4/site-packages/kaa/notifier/main.py", line 
96, in run
     notifier.step()
   File 
"/usr/lib/python2.4/site-packages/kaa/notifier/pynotifier/nf_generic.py", 
line 164, in step
     __sockets[ IO_EXCEPT ].keys(), timeout )
   File "/usr/lib/python2.4/site-packages/freevo/main.py", line 330, in 
signal_handler
     traceback.print_stack()
   File "/usr/lib/python2.4/traceback.py", line 247, in print_stack
     print_list(extract_stack(f, limit), file)
   File "/usr/lib/python2.4/traceback.py", line 283, in extract_stack
     line = linecache.getline(filename, lineno)
   File "/usr/lib/python2.4/linecache.py", line 14, in getline
     lines = getlines(filename)
   File "/usr/lib/python2.4/linecache.py", line 40, in getlines
     return updatecache(filename)
   File "/usr/lib/python2.4/linecache.py", line 101, in updatecache
     lines = fp.readlines()
   File "/usr/lib/python2.4/site-packages/freevo/main.py", line 330, in 
signal_handler
     traceback.print_stack()
shutdown(menuw=None, argshutdown=None, argrestart=None, exit=False)
DJW2:sys.exit(0)
DJW:notifier.main.stop()
DJW:os.waitpid before
DJW:why: [Errno 10] No child processes
DJW:Stopped kaa main run loop

Making the change and then ctrl-c gives:
DJW:shutdown(exit=True)
   File "/usr/lib/python2.4/site-packages/freevo/main.py", line 483, in ?
     kaa.main.run()
   File "/usr/lib/python2.4/site-packages/kaa/notifier/main.py", line 
96, in run
     notifier.step()
   File 
"/usr/lib/python2.4/site-packages/kaa/notifier/pynotifier/nf_generic.py", 
line 164, in step
     __sockets[ IO_EXCEPT ].keys(), timeout )
   File "/usr/lib/python2.4/site-packages/freevo/main.py", line 335, in 
signal_handler
     traceback.print_stack()
shutdown(menuw=None, argshutdown=None, argrestart=None, exit=False)

The problem is that it is intermittent sometimes it works sometimes it 
doesn't.

>> Yes I've noticed this too, sometimes it works just fine and other times
>> it just doesn't spawn the process. I think that it works first time
>> after the recordserver has been started but not afterwards. Simply by
>> deleting the site-packages-kaa and installing kaa-base-0.3.0 it records
>> every time.
> 
> We did some massive changes in kaa.base including changing file
> names. So it is a very good idea to delete site-packes/kaa and all
> build directories in the source tree and install again.

I always do this as soon as I see a deleted file or something not 
working quite right.


The webserver uses Twisted and kaa.rpc client stuff, the shut down is a 
bit messy. Also I don't see quite why the kaa.notifier code is being 
used, except from the record_client.

2008-02-29 17:26:39,749 DEBUG    webserver.py (114): main() starting
Traceback (most recent call last):
   File "/usr/lib/python2.4/site-packages/freevo/helpers/webserver.py", 
line 115, in ?
     main()
   File "/usr/lib/python2.4/site-packages/freevo/helpers/webserver.py", 
line 108, in main
     reactor.run()
   File 
"/usr/lib/python2.4/site-packages/twisted/internet/posixbase.py", line 
218, in run
     self.mainLoop()
--- <exception caught here> ---
   File 
"/usr/lib/python2.4/site-packages/twisted/internet/posixbase.py", line 
229, in mainLoop
     self.doIteration(t)
   File 
"/usr/lib/python2.4/site-packages/twisted/internet/selectreactor.py", 
line 97, in doSelect
     [], timeout)
   File "/usr/lib/python2.4/site-packages/kaa/notifier/main.py", line 
225, in signal_handler
     sys.exit(0)
exceptions.SystemExit: 0
2008-02-29 19:42:11,881 DEBUG    webserver.py (116): main() finished

The latest set of changes to kaa is causing the Popen to fail and 
because of this causing recordings to be lost I'm not using rel-1 any more.

I don't think kaa it is responsible for the shut down problems.

Duncan


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to