Skip to content
This repository has been archived by the owner on May 17, 2020. It is now read-only.

Two instances of sketch running after startup #2

Open
spiderdab opened this issue Sep 9, 2016 · 8 comments
Open

Two instances of sketch running after startup #2

spiderdab opened this issue Sep 9, 2016 · 8 comments

Comments

@spiderdab
Copy link

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
Copy link
Owner

gohai commented Sep 10, 2016

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
Copy link
Author

spiderdab commented Sep 11, 2016

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
Copy link
Owner

gohai commented Sep 11, 2016

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
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

gohai commented Sep 11, 2016

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
Copy link
Author

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
Copy link
Owner

gohai commented Sep 14, 2016

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?

@gohai gohai changed the title Strange behavior. Two instances of sketch running after startup Sep 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants