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

help: how to debug script interrupting?

  • 224 Replies
  • 39104 Views
Re: help: how to debug script interrupting?
« Reply #10 on: 01 / July / 2012, 14:27:24 »
Advertisements
1)
i'm now running test on the whole script
where i did substitute
sleep & is_pressed
with
wait_click & is_key

and it seems problems are gone...
(so the problem was probably inside the is_pressed() function)

however I'll run a test all nigh long to verify my hypotesis
If I'll have problems I'll try the code you suggested.

2)yes , I did disable the automatic shutdown

Re: help: how to debug script interrupting?
« Reply #11 on: 01 / July / 2012, 14:37:10 »
Incidentally,  I took another look at your script and it seems like you are trying to calculate USB remote pulse widths using the tic timer ?     Did you know there is built-in fuctionality to do that ?

stable trunk > http://chdk.wikia.com/wiki/USB_Remote_Cable#Pulse_Width_Remote_Script_.28Advanced_Topic.29

and

dev trunk > http://chdk.wikia.com/wiki/USB_Remote_V2#Scripting_Interface
Ported :   A1200    SD940   G10    Powershot N    G16

Re: help: how to debug script interrupting?
« Reply #12 on: 02 / July / 2012, 07:10:10 »
Quote
Did you know there is built-in fuctionality to do that ?

yes thanks but I need to check pulse during press not after release... thanks anyway

So, new results:
last test had a failure during night so I tried your supersimple scripts
Code: [Select]
--[[
@title R1test
]]

function waitForSetMenu()
    repeat
        sleep(1000)
    until ( false )   
    return menuItem
end

local rv = waitForSetMenu()
print("VALUE = "..rv)

With this script I had no problems, but then I tried this one
Code: [Select]
--[[
@title R1test
]]

function waitForSetMenu()
    repeat
        wait_click(100)
    until ( false )   
    return menuItem
end

local rv = waitForSetMenu()
print("VALUE = "..rv)

(just substitued sleep with wait_click) and did have problems!
So it seems the wait_click() function generated randomly some problems...
Actually I had problems even with is_pressed function... it seems like all
these "click managament" functions have problems... is it possible?

(today later I'll perform heavy tests on 60 cams and let you know results)
thanks

Re: help: how to debug script interrupting?
« Reply #13 on: 02 / July / 2012, 09:32:52 »
So it seems the wait_click() function generated randomly some problems...
Actually I had problems even with is_pressed function... it seems like all
these "click managament" functions have problems... is it possible?
Yes.

What camera are you using ? 

And have you tried the dev build instead of the stable build ?   The USB remote code is completely different between them.

Update :  I remember now - sx130 right ?  And we moved you to the dev branch to get sync delay working ?
« Last Edit: 02 / July / 2012, 09:35:17 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


Re: help: how to debug script interrupting?
« Reply #14 on: 02 / July / 2012, 13:24:51 »
So , new results:
i made test with 60 cameras and tried all possible script,
also the supersimple one that just sleeps sometimes crashes...

this is too strange... I dont think the "sleep" function should cause problems...
so I'm thinking about another hypotesis:
Of course, to save money, we bought 60 power supply transformers (chinese... no original ones),
that generate 3.25 V.
Maybe those trasnformers are not very stable... do you think that some kind of electric unstability
could cause such problems?

thanks

Quote
I remember now - sx130 right ?  And we moved you to the dev branch to get sync delay working ?

yes it true, actually i did not yet pass to the dev build since I guessed the "stable" one is more... stable... but I'll try soon the dev one...
« Last Edit: 02 / July / 2012, 13:27:48 by Alarik »

Re: help: how to debug script interrupting?
« Reply #15 on: 02 / July / 2012, 13:34:54 »
So , new results: i made test with 60 cameras and tried all possible script, also the supersimple one that just sleeps sometimes crashes...
Very interesting !   So what happens if you just boot with CHDK and let the cameras sit there ? Does that crash too ?

Its possible the sx130 CHDK code has a timing dependent bug unrelated to scripting ?  That's going to be a major problem to find if so.

Quote
this is too strange... I dont think the "sleep" function should cause problems...
You would not think so either.  What if you make the code even simpler - a hard infinite loop ?

Quote
so I'm thinking about another hypotesis: Of course, to save money, we bought 60 power supply transformers (chinese... no original ones), that generate 3.25 V. Maybe those trasnformers are not very stable... do you think that some kind of electric unstability could cause such problems?
Possible - but if that's the case,  just leaving the cams powered ( with or without CHDK ) should cause them to "crash" too.

Quote

yes it true, actually i did not yet pass to the dev build since I guessed the "stable" one is more... stable... but I'll try soon the dev one...
Probably not going to make any difference if its an electrical problem.

Ported :   A1200    SD940   G10    Powershot N    G16

Re: help: how to debug script interrupting?
« Reply #16 on: 02 / July / 2012, 14:34:27 »
Quote
So what happens if you just boot with CHDK and let the cameras sit there ? Does that crash too ?

actually the "crash" i'm facing its not a camera crash but a script crash (i.e. it exits by itself saying "press shutter to close"), so if I just turn on cams and dont let run any script I dont have problems... Problems arise only when a script is executing.

Quote
What if you make the code even simpler - a hard infinite loop ?
I'll try that tomorrow and let you know.

Quote
Possible - but if that's the case,  just leaving the cams powered ( with or without CHDK ) should cause them to "crash" too.
as said I have problems only when a script is running... I thought that maybe a little variation on the VOLTs has a very thin impact on the cam, so that cam has no problems but maybe the script is (for some reason) more "sensible" to a variation in the electric power... (its a very empirical hypotesis, i know....)

I keep testing and let you know results... This is a very strange problem, today I had problems on 50 cams out of 60, there's a bunch of "perfect" cams... weird...


Re: help: how to debug script interrupting?
« Reply #17 on: 02 / July / 2012, 14:59:29 »
actually the "crash" i'm facing its not a camera crash but a script crash (i.e. it exits by itself saying "press shutter to close"), so if I just turn on cams and dont let run any script I dont have problems... Problems arise only when a script is executing.
I took a look at the code and the only time it generates that message is when the Lua script engine cannot successfully execute the next line of code in the script.  The scripting engine is not crashing - its just not able to understand the next thing it was asked to do. Given that the script is basically running the same lines over & over again,  this suggests some sort of memory corruption / stack overflow /  memory leak error.   Scarey stuff.

Update :  I almost hate to suggest this,  but can you try a uBASIC version of the simple sleep script and see if it too "crashes" after a while ?    (Must be nice having 50 cameras when testing ...)
« Last Edit: 02 / July / 2012, 15:18:42 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


Re: help: how to debug script interrupting?
« Reply #18 on: 05 / July / 2012, 08:59:27 »
so I made new tests with my 60 cams...

hard loop: crashed
(when i say "crashed" I mean the "press shutter to close" ending msg that happens randomly on some of my 60 cams)

any sleep: crashed

any wait_click: crashed

tried then the very simple script REMOTE.BAS included in chdk... : crashed that too...

I tried then to understand if the problem was related to the "enable remote" feature,
so I made a script that perform all tests I have been doing (hard loop, sleep, wait_clic, etc...)
but disabling the "enable remote" via script...
It crashed again but the strange thing was that even if I did disable the enable remote feature, the script was still responding to my remote clicks...
So I definitly decided to move to the dev branch with the new developed remote features.

As soon as I'll have tests result I'll post them.

PS:
Quote
The scripting engine is not crashing - its just not able to understand the next thing it was asked to do

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...

thanks

Re: help: how to debug script interrupting?
« Reply #19 on: 05 / July / 2012, 09:13:24 »
but the strange thing was that even if I did disable the enable remote feature, the script was still responding to my remote clicks...
Scripts can monitor the state of the USB power regardless of whether the remote is enabled or not.  Enabling remote is mostly used to tell the camera not to go into "photo download mode - computer connected" when the USB power is detected and to tell CHDK to run its built-in remote code if selected.

Quote
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...
Not sure that would work.  The scripting engine thinks that the next line its supposed to execute is invalid. As that means something is very wrong, where does it go next ? Why would there be valid code next ?  If we continue to let the engine run,  it could very well interpret thing that cause it to do something bad ...
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics