gohai / processing-uploadtopi

Tool for Processing to upload and run a sketch on a Raspberry Pi from within the IDE
39 stars 8 forks source link

Two instances of sketch running after startup #2

Open spiderdab opened 8 years ago

spiderdab commented 8 years ago

Hi, I don't know if it's 'uploadtopi' related problem, but as soon as I upload a sketch it works perfectly, instead as I reboot the raspberry, and the sketch run autonomously, the sketch behave strangely... the sketch uses the http request library to send message as a telegram bot, and normally it works ok. But if the sketch autorun after a reboot, the sketch sends two time the same message every time. Do you have any idea? Thanks.

gohai commented 8 years ago

Is it possible that the sketch is being executed twice?

Could you attach the content of ~/.config/lxsession/LXDE-pi/autostart, as well as .config/lxsession/LXDE-pi/processing.sh? The output of ps -All after startup would also be interesting.

spiderdab commented 8 years ago

Hi and thank you for your attention. the files seem to be ok: cat .config/lxsession/LXDE-pi/autostart .config/lxsession/LXDE-pi/processing.sh --uploadtopi-managed and.. cat .config/lxsession/LXDE-pi/processing.sh ./Telegram_Bot_4_dabberry/Telegram_Bot_4_dabberry --uploadtopi-managed >>./Telegram_Bot_4_dabberry/Telegram_Bot_4_dabberry.log 2>&1 while in fact there are 2 processes running together: ps -All | grep Telegram 0 S 1000 3066 3065 0 80 0 - 441 wait ? 00:00:00 Telegram_Bot_4_ 0 S 1000 3192 3190 0 80 0 - 441 wait ? 00:00:00 Telegram_Bot_4_ but I can't figure out what can make it run twice...

gohai commented 8 years ago

Odd. What happens if you remove the line from autostart? Does one of the two still launch?

Does killing both (killall java) and launching the sketch from the terminal (DISPLAY=:0 ./Telegram_Bot_4_dabberry/Telegram_Bot_4_dabberry) also spawn two instances?

spiderdab commented 8 years ago

I just tried to killall both processes and run the sketch from the terminal, and I still have double messages. If instead I remove the line from autostart using ## before, I don't have any process and in fact I have no response in telegram.

spiderdab commented 8 years ago

so this seems to depend from the sketch, but why I have two twin processes? and also as I upload the sketch using your tool, it runs ok.

gohai commented 8 years ago

What happens if you replace the content of the sketch with a dummy sketch (just empty setup and draw), and upload it via the tool and the same name?

Does it still spawn two instances?

spiderdab commented 8 years ago

Hi, I've tried a new empty sketch with just one println"something"; command in the setup. Same result: as soon as I upload it runs correctly, then if I reboot i can see two processes with the same name.

gohai commented 8 years ago

And you're testing on a vanilla (unmodified) Raspbian image?

One idea that I had: perhaps your window manager re-opens the applications automatically, that were open at shutdown? Does it also appear when you make sure the sketches have terminated before you restart?