help: how to debug script interrupting? - page 3 - General Discussion and Assistance - CHDK Forum
supplierdeeply

help: how to debug script interrupting?

  • 224 Replies
  • 44243 Views
Re: help: how to debug script interrupting?
« Reply #20 on: 05 / July / 2012, 14:20:41 »
Advertisements
ok
so I moved to the dev unstable version (rev 1950)
unfortunatly I keep having the "press shutter to close" problem, but now I really think
is a power supply tranformer problem... I mean if nobody else had this problem, this is
the only "different" part...

If I can I'll try with batteries and see if the problem disappear.

The good news is that I tested all the synch features and they work perfectly,
soon I'll try to set 1 ms of delay between each of the 60 cams to have a super rallenty sequence
and i'll be able to tell if cams are so fine synchronized...

if something that can explain the "press shutter to close" problem comes to your mind, please let me know (or even if you want me to debug/test features... you know I have 60 cams I can do a lot of usefull tests)

thanks for all

*

Offline reyalp

  • ******
  • 13673
Re: help: how to debug script interrupting?
« Reply #21 on: 05 / July / 2012, 14:53:21 »
Don't you think it would be possible to somehow CATCH this error and ignore it before it terminates the script? I mean, the error happens during a loop waiting for a remote click. Even if the script fails I could ignore this fail ane keep looping...
There is a "restart lua on error" option in the debug menu.

You haven't identified where the error is actually happening in any useful way, so there's very little we can do to help you. Alternatively, if you can post a full script that reliably reproduces the problem, that might also be help.

"Press shutter to close" just means the script ended with an error. There should be an error message.
Quote
but now I really think
is a power supply tranformer problem...
It is extraordinarily unlikely that a power supply problem would somehow only affect the scripting part of the kbd task.
Quote
if something that can explain the "press shutter to close" problem comes to your mind, please let me know (or even if you want me to debug/test features... you know I have 60 cams I can do a lot of usefull tests)
As I said before, use normal debugging strategies to identify what is actually happening. Print before the sleep / wait, print after the sleep / wait, print in restore... We don't need more cameras, we need more information.
Don't forget what the H stands for.

Re: help: how to debug script interrupting?
« Reply #22 on: 05 / July / 2012, 16:39:32 »
There is a "restart lua on error" option in the debug menu.
That's a little different than "continue lua on error" but might be useful if he writes his script to anticipate being restarted occassionally so that it picks up where it left off.

Quote
You haven't identified where the error is actually happening in any useful way, so there's very little we can do to help you. Alternatively, if you can post a full script that reliably reproduces the problem, that might also be help.
I was thinking he had been pretty explicit.  He even has it halting when the script does nothing but a "hard loop"

Code: [Select]
repeat
until ( 0 )

and its doing it in both Lua and uBASIC.

So the possibilities are :
1) Hardware ?   Same cameras and elcheapo power supplies.  Unlikely though - why would only scripts halt (they are not really crashing ...)
2) Generic CHDK error?   Possible but I don't believe I've heard this before ?  Or maybe people with 1 camera don't notice the way someone with 50 cameras does.
3) Problem with the SX130 specific code ? Seems more likely than #2.


Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 13673
Re: help: how to debug script interrupting?
« Reply #23 on: 05 / July / 2012, 18:27:02 »
Code: [Select]
repeat
until ( 0 )
If this is accurate, then memory corruption seems like about the only plausible option. Information about approximately how long it takes for the problem to occur would be helpful.

Running out of memory might cause similar problems, but that should at least sometimes print an out of memory error, and also cause other stability issues.

This camera is forced to exmem in the autobuild, because it has very little memory. With modules, maybe it can run non-exmem now ? Would be worth a try.

Being in a tight loop without any sleep or other blocking functions might cause problems, but it shouldn't cause this problem.
Don't forget what the H stands for.


Re: help: how to debug script interrupting?
« Reply #24 on: 05 / July / 2012, 18:41:22 »
If this is accurate, then memory corruption seems like about the only plausible option. Information about approximately how long it takes for the problem to occur would be helpful.
He mentioned it taking hours ... and he has a few cameras that have (so far) never done it.   But this leads me first to a problem with the sx130 port ?  I looked at the CAM_UNCACHED_BIT for example but it matches what stubs_entry.S says its supposed to be.

Quote
Running out of memory might cause similar problems, but that should at least sometimes print an out of memory error, and also cause other stability issues.

This camera is forced to exmem in the autobuild, because it has very little memory. With modules, maybe it can run non-exmem now ? Would be worth a try.
I could do a build for him without exmem and maybe everything but Lua turned off ?

Quote
Being in a tight loop without any sleep or other blocking functions might cause problems, but it shouldn't cause this problem.
We worked our way down to that - having just a sleep(1000) in the middle of that loop caused the script to stop too.  In fact.  pretty much every script variation I could think of stopped after a while.

Wild question :  could there be some other CHDK freature causing this ? Is it worth flushing CCHDK.CFG from all the cams and restarting in default mode ?

« Last Edit: 05 / July / 2012, 18:43:30 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 13673
Re: help: how to debug script interrupting?
« Reply #25 on: 05 / July / 2012, 19:07:27 »
Wild question :  could there be some other CHDK freature causing this ? Is it worth flushing CCHDK.CFG from all the cams and restarting in default mode ?
Seems unlikely.

from earlier:
Quote
and its doing it in both Lua and uBASIC.
Unless I'm missing something, this message cannot be produced for ubasic, ubasic displays errors differently.

The message comes from  script_wait_and_end which is only called from lua_script_error. That will only be called if lua return an error compiling or running the script.

Don't forget what the H stands for.

Re: help: how to debug script interrupting?
« Reply #26 on: 05 / July / 2012, 19:18:18 »
Unless I'm missing something, this message cannot be produced for ubasic, ubasic displays errors differently.  The message comes from  script_wait_and_end which is only called from lua_script_error. That will only be called if lua return an error compiling or running the script.
Yes - I read that in the code too.   

Work with me here ?  We've reduced this to the simplest combinations I can think of and apparently the camera drops out of script execution mode running either Lua or uBASIC. 

In the uBASIC case, he tried the default remote.bas script, left it running and it exited for no reason. 
http://chdk.setepontos.com/index.php?topic=8273.msg87407#msg87407

You might not get a nice message from uBASIC but it stops running.

Something specific other than "use good debugging techniques" would be helpful here.  When incredibly simple scripts stop after a while on their own, I'm out of ideas.  So I'll step back and hope you can come up with something he can try.  TIA.




Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 13673
Re: help: how to debug script interrupting?
« Reply #27 on: 05 / July / 2012, 19:56:05 »
Changing lua panic to do a camera assert might be helpful. Or memory dump and then assert.

I'm at a loss to explain how ubasic could exhibit the same symptom. It will either exit normally (from reaching the end of the script) or display the ubasic error box. If the claim is that it ends without doing either, I find that quite unlikely. If it reaches the end of the script, it should trigger restore. Whether it does or not would be a potentially useful data point.

Another thing that could spontaneously end scripts is if there is something generating phantom key presses (which phil suspected in a different issue)... but in that case it should print the interrupted message.

fwiw, I've been running my d10 in a sleep loop for several hours and it seems to be fine.
Don't forget what the H stands for.


Re: help: how to debug script interrupting?
« Reply #28 on: 05 / July / 2012, 20:25:53 »
Changing lua panic to do a camera assert might be helpful. Or memory dump and then assert.
thanks  -  added to the "to do" list

Quote
I'm at a loss to explain how ubasic could exhibit the same symptom. It will either exit normally (from reaching the end of the script) or display the ubasic error box. If the claim is that it ends without doing either, I find that quite unlikely. If it reaches the end of the script, it should trigger restore. Whether it does or not would be a potentially useful data point.
@Alarik :  sounds like more detail about what happens when uBASIC stops would be good here.  Can you do an "infinite loop" uBASIC script and report exactly what you see on the screen if/when it stops ?

Quote
Another thing that could spontaneously end scripts is if there is something generating phantom key presses (which phil suspected in a different issue)... but in that case it should print the interrupted message.
Hmmm ... gets us back to the elcheapo power supplies maybe ? 
@Alarik : all of the things you see on the screen exactly as they appear are significant and important here ..

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 13673
Re: help: how to debug script interrupting?
« Reply #29 on: 05 / July / 2012, 21:18:01 »
Hmmm ... gets us back to the elcheapo power supplies maybe ? 
@Alarik : all of the things you see on the screen exactly as they appear are significant and important here ..
It would be quite mind boggling if a bad power supply could make both kinds of scripts die without killing kbd task. kbd_task dying would render the camera unusable.

It is possible for unstable hardware to die repeatable under some particular conditions, but it's its very difficult to see that happening for both ubasic and lua, while everything else seems to work fine.

d10 is still running... battery life seems quite good in playback mode. Does it have to be in rec for this to happen ?
« Last Edit: 05 / July / 2012, 21:22:18 by reyalp »
Don't forget what the H stands for.

 

Related Topics