Error message in Webserver when receiving commands

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
Mastiff
Experienced User
Posts: 865
Joined: Thu May 03, 2012 10:43 am

Error message in Webserver when receiving commands

Post by Mastiff » Fri Jun 29, 2018 6:50 am

I am using a simple function in Girder to send to EventGhost. This is in LUA, and it should work very easily:

Code: Select all

function SendEG(pld1,pld2,pld3)
    res = socket.http.request('http://MyUsername:MyPassword@192.168.0.100:9878/?' .. pld1 .. '&' .. pld2 .. '&' .. pld3)
    print(res)
end
Then I call it like this:

Code: Select all

SendEG('Forsterker','3','1')
I have a separate instance of webserver running on port 9878, with my username and password and Girder as the event prefix, and into EG the message comes like this :

Code: Select all

08:45:17   Girder.Forsterker[u'3', u'1']
And it does the job, the amplifier is turned on as it should. But it throws an error too, and I'd like to get rid of that:

Code: Select all

08:37:02            Webserver error /?Forsterker&3&1
08:37:02            Webserver: Exception on handle_one_request: 'ascii' codec can't decode byte 0xe5 in position 66: ordinal not in range(128)
08:37:02            ----------------------------------------
08:37:02            Exception happened during processing of request from ('::ffff:192.168.0.100', 52345, 0, 0)
08:37:02            Traceback (most recent call last):
08:37:02              File "SocketServer.pyc", line 596, in process_request_thread
08:37:02              File "SocketServer.pyc", line 331, in finish_request
08:37:02              File "SocketServer.pyc", line 654, in __init__
08:37:02              File "SocketServer.pyc", line 713, in finish
08:37:02              File "socket.pyc", line 283, in close
08:37:02              File "socket.pyc", line 307, in flush
08:37:02            error: [Errno 10053] An established connection was aborted by the software in your host computer
Can somebody please help me out?

User avatar
kgschlosser
Site Admin
Posts: 3952
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Error message in Webserver when receiving commands

Post by kgschlosser » Fri Jun 29, 2018 6:33 pm

that is because of girder not eventghost.
girder is closing the connection at the wrong time. It seems as tho girder is not waiting around for the webpage (eg's webserver in this case) to finish before dumping the connection.

question. why the use of Girder?


also an FYI, girder is no more. The owner closed up shop
If you like the work I have been doing then feel free to Image

Mastiff
Experienced User
Posts: 865
Joined: Thu May 03, 2012 10:43 am

Re: Error message in Webserver when receiving commands

Post by Mastiff » Fri Jun 29, 2018 7:19 pm

Wow, I didn't know that Ron has gone completely over to his other business. It's been a year or so since I mailed him last. Well, it was a good run, must have been 20 years or more. I can run Girder 5.1 forever, I think. :mrgreen: The reason is simply that I have a very complex setup programmed in Girder, with the help of some people there, that takes of most of the front end, with Lua and HTML, where I control the tempernature of the heating system, choose radio channels, turn on and off amps and lights, and so on and so on. I have that split from EvengGhost, which takes care of the "current affairs", with thermostat control and so on, and a Pi with Node-RED for RFXtrx and Tellstick Duo, and Home Assistant for Z-Wave (since the door lock control in Node-RED is not playing nice with my door lock). Reprogramming that would probably take more than my 52 year old body has left in it. :lol:

Can I get around this in a way? I notice that if I run the same code without the script it trigges, there's no such error mesages. But I have a weird problem with "current Q size: 14" at the moment and the icon being red much of the time. Something in the system is slowing it down. It must be in the temperature code, because that's that mostly what's running. Is it possible to see what code's taking up the ressources? EG is using around 31 % of the CPU in the VM, and around 84 000 kB memory. My cabin setup is using close to 0 CPU and about the same memory, so something is definitively wrong at the house system.

Edit: Yeah, I do have five times as many sensors in the house, but still I haven't had this problem before.

Mastiff
Experienced User
Posts: 865
Joined: Thu May 03, 2012 10:43 am

Re: Error message in Webserver when receiving commands

Post by Mastiff » Fri Jun 29, 2018 7:47 pm

Never mind the CPU problem, I found it. A logging I had started a few weeks back to syncronize temp sensors, and I had forgotten to turn it off. The text file with info was now 400+ meg! :roll: :mrgreen:

Mastiff
Experienced User
Posts: 865
Joined: Thu May 03, 2012 10:43 am

Re: Error message in Webserver when receiving commands

Post by Mastiff » Fri Jun 29, 2018 7:49 pm

And suddenly the error stopped! So it was all due to the slowdown. This thread can be burnt to a crips and flushed down the toilet, James Bond style! :oops:

User avatar
kgschlosser
Site Admin
Posts: 3952
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Error message in Webserver when receiving commands

Post by kgschlosser » Sat Jun 30, 2018 4:03 am

LOL

It could have been that the logging was causing the socket timeout on the girder end of things so EG was seeing it as a disconnect. It all depends on how the logging was being handled..

If there is that much data that needs to be written to a file then i would suggest that you create a separate thread with a queue and a wake event and have the thread stall if nothing needs to be written.en and when something comes along to write to it. it will place it in the queue and then wake the thread. in the loop for the thread you do a while statement so it will keep dumping whatever is in the queue until it is empty. then the thread will go bak to sleep. This is a nice mechanism because you can open the file a single time. and then close it using the atexit module. so there is not all the extra overhead for opening and closing each time a write operation takes place. it all makes the logging entries thread safe so only a single write is taking place on the file so the data being written doesn't get all jumbled up.

I don't think i mentioned I am familiar with lua it's not all that different from python. If there is anything that you need help with in respect to that end of your setup. let me know.

It appears as tho Ron has locked the forum all but the Girder6 section of it. I do not know how long the board will remain open. I did register and post a comment in his announcement but there was no indicator of the board eing closed. i ended up seeing that bit of information from a mobile device. I have not checked to see if it shows up in a normal browser. I may have simply missed seeing it. But if you do chat with Ron via some other method. let him know that i posted a message and it is probably in the moderators queue. if he wants to see it and respond to it.

Essentially my message to him was it is always a sad day to see a developer close their doors. and i wished him well in his endeavors. I also offered to host the forums free of charge so the users that are using Girder still have a place to be able to get help if they need it. We have the ability to host as many websites as the memory/cpu of our VPS allows for. and right now we are not even scraping the surface of what it can do.
If you like the work I have been doing then feel free to Image

Mastiff
Experienced User
Posts: 865
Joined: Thu May 03, 2012 10:43 am

Re: Error message in Webserver when receiving commands

Post by Mastiff » Sat Jun 30, 2018 7:24 am

Actually the logging was through Krambriw's climate data calculation plug-in, but without a limit of logging each sensor only once every ten minutes, like I normally do. So there was a bunch of stuff coming in. And it is in a separate thread, I just had forgotten that fact. So I should have known that at once I saw the message about "current Q size" because that's the wording in the plug-in that was put in on my request a couple of years ago for showing what happened when running big reports!

I left a message in the closing thread, I didn't want to barge in with a mail since I didn't see the message about closing up until now. :oops:

And thanks, I do sometimes need Lua help, so it's great to know that you can help out! :mrgreen:

User avatar
kgschlosser
Site Admin
Posts: 3952
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Error message in Webserver when receiving commands

Post by kgschlosser » Sat Jun 30, 2018 4:52 pm

this is the thread you posted in???

https://www.promixis.com/forums/showthr ... ng-up-shop


because your post is not there. If you view the forum from a mobile device you will see that notice about the forum being closed except for the girder 6 thread.

So if you have means to get a hold of him via e-mail you can extend my offer to him as far as the hosting of the forum. so the History will be there for the users as well as the users can seek support from other users. This is extremely important we want the current users to not have a system that just stops running with no means of getting help. The domains and whatever else he keeps. he will need to point the DNS to our IP and he is the one that will retain all administrative privileges. I would have to do some more learning on setting up ACL on our server so he would have FTP access and shell access to his files. other then that is should be a pretty simple thing to accomplish.
If you like the work I have been doing then feel free to Image

Mastiff
Experienced User
Posts: 865
Joined: Thu May 03, 2012 10:43 am

Re: Error message in Webserver when receiving commands

Post by Mastiff » Mon Jul 02, 2018 7:42 pm

I will try to mail him in a while, but that thread is moderated, so it gets updated when Ron has time to pop in and check on it. He will see it, even if it takes time. I have mailed him on the Promixis address, so if he does 't see the updatesin the thread he probably won't see that mail either.

Post Reply