LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-03-2018, 03:33 PM   #1
hcgrant
Member
 
Registered: Feb 2004
Location: UK Hertfordshire
Distribution: Opensuse 15.1 plus a Mac and a Vista and loadsa little Raspberry Pis
Posts: 51

Rep: Reputation: 15
python http.server stops responding


Im running a simple python webserver on a raspberry pi (http.server) under the latest raspbian.
Now and again it fails to respond to clients though I cant see any pattern in the failures.
ps ax shows the program is still running.( ssh'ing to the pi)
Kill the program and restart it .. and its working fine and responding as it should.

Ive sprinkled the program with prints to a log file but I cant see anything meaningful in the log. It just seems to stop. The log file isnt large a few 100k. The pi's hard disk (yup :-) ) is 250G.

The server is only serving my local network, it gets only a few requests a day (say 6 ? ). It displays the temperature and humidity of the rooms in my house.(Gathered by other pi's and sent to the pi hosting the webserver and saved in text files) It has a couple of "buttons" to switch the boiler on and off.

Also running on the pi is Pi_Hole, an add removing DNS server which also serves up webpages using lighttpd and my own python program gathering and saving the humidity and temperature reports.

Can anyone point me in the direction of some bug detection techniques .. it may be that I'm using the module incorrectly of course .. So any suggestions of methods for getting more information would be great.
 
Old 12-04-2018, 08:03 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 15,435

Rep: Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066
you need to insert print/log/debug statements into that python script. That is all I can suggest you at this moment. If you have no idea about the reason you need to put a lot of logs to find it.
 
Old 12-04-2018, 09:37 AM   #3
hcgrant
Member
 
Registered: Feb 2004
Location: UK Hertfordshire
Distribution: Opensuse 15.1 plus a Mac and a Vista and loadsa little Raspberry Pis
Posts: 51

Original Poster
Rep: Reputation: 15
Thanks pan64 .. but I've done that :-((
 
Old 12-04-2018, 09:40 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 15,435

Rep: Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066
no, not yet. I mean if you could not find the reason you need to put more logs into the code. Probably on every function, probably even more logs (probably on every line) required to find out where is it stopped.
If you knew where you could also find the reason: why by also printing variables and other information related to the actual code.

Last edited by pan64; 12-04-2018 at 09:41 AM.
 
Old 12-06-2018, 05:08 AM   #5
hcgrant
Member
 
Registered: Feb 2004
Location: UK Hertfordshire
Distribution: Opensuse 15.1 plus a Mac and a Vista and loadsa little Raspberry Pis
Posts: 51

Original Poster
Rep: Reputation: 15
To pan64 ..
Ive added logs to the start of all functions now, previously just on exit.
Now Ive just got to wait for it to fail :-))
 
Old 12-16-2018, 09:20 AM   #6
hcgrant
Member
 
Registered: Feb 2004
Location: UK Hertfordshire
Distribution: Opensuse 15.1 plus a Mac and a Vista and loadsa little Raspberry Pis
Posts: 51

Original Poster
Rep: Reputation: 15
Found the problem !
I ran the python script in idle3 and waited and waited for it to fail.
It turns out that the failure was due to a network failure in an other Pi and nothing to do with the webserver !
The script uses pigpio to access the state of a relay in the other Pi .. which is controlling the central heating boiler.
This controller Pi's networking has failed and hence the failure.

So ... on to that problem!

With regard to my original question adding lots of logs and running the script in idle3 helped solve the problem.
Most effective I think was running it in idle3 to get its error messages
Regards
 
Old 12-17-2018, 02:44 AM   #7
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 15,435

Rep: Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066Reputation: 5066
that is something to learn: use descriptive error messages.
And another thing, if you wish you can implement some kind of timeout handling which can help you in similar cases.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache stops responding to HTTP requests every few days GrdLock Linux - Server 3 12-29-2010 05:47 PM
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 08:30 PM
Linux server stops responding to telnet requests lab123 Linux - Networking 1 10-25-2005 11:51 AM
Server stops responding, ssh, etc.. ddelao Linux - Software 0 09-04-2005 09:50 AM
Suse Server 8.0 Stops Responding Henry1 SUSE / openSUSE 0 01-07-2005 12:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration