Socket send() 55 error

Posted on
Fri Dec 04, 2020 8:36 am
PME999 offline
Posts: 54
Joined: Jul 28, 2012

Socket send() 55 error

Hello,
Since few days, just after BIGSUR update (I don’t know if there is a link), I have a socket error see below that cause a strange behavior of indigo server. The reflector sometimes is down and sometimes not. I have many script in schedules or triggers, maybe a part of the explanation ? Is it better to execute these script in a file instead of in indigo directly ?
Is there and other explanation ?
Please help
Thanks a lot
Patrice

See below an example of what happen when the server goes down and stay down.

2020-12-04 13:16:29.598 Error socket send() 55 error
2020-12-04 13:16:29.598 Error socket send() 55 error
2020-12-04 13:16:30.607 Error socket send() 55 error
2020-12-04 13:16:30.620 Schedule SCHEDULE Récupération JEEDOM PETCARE Position Batterie et heure passage
2020-12-04 13:16:30.620 Schedule SCHEDULE Recuperation Heure Les Saisies msql python
2020-12-04 13:16:30.620 Schedule SCHEDULE Insérer heure msql
2020-12-04 13:16:39.605 Error because embedded scripts execute sequentially they must complete their execution within 10 seconds.
2020-12-04 13:16:39.605 Error modify the script to exit quickly or convert it to an external file (not embedded).
2020-12-04 13:16:39.605 Application Stopping embedded script executor host1 (pid 14535)
2020-12-04 13:16:40.611 Schedule SCHEDULE Récupération JEEDOM PETCARE Position Batterie et heure passage
2020-12-04 13:16:40.612 Schedule SCHEDULE Insérer heure msql
2020-12-04 13:16:41.730 Error process (pid 14535) failed to quit after polite request -- forcing it to quit now
2020-12-04 13:16:41.731 Application Stopped "embedded script executor host1"
2020-12-04 13:16:44.145 Application Embedded script executor host1 started

Posted on
Fri Dec 04, 2020 10:07 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Socket send() 55 error

It might be that you have an embedded script that's making some kind of network connection. The network connection is failing in some new way, which is hanging up the process that executes all embedded scripts. If you can identify the script that's making the network connection and failing then you can move it to an external script so that it will fail without taking down the embedded script process. You can also diagnose why the script is failing and put in the appropriate timeout/error trapping to figure out why it's failing. It might be coincidental that it began failing after your macOS upgrade, or something in Big Sur might be blocking or otherwise causing the connection to fail.

Your reflector being down sporadically might also indicate that you have some systemic but sporadic network issues on your Mac. The reflector process is completely separate from Indigo running scripts so one shouldn't effect the other (directly).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Dec 04, 2020 11:38 am
PME999 offline
Posts: 54
Joined: Jul 28, 2012

Re: Socket send() 55 error

Thanks lot Jay for your quick support
I will try to identify the embedded script but not so easy because I have many to write into a sql database...
Concerning your suggestion about diagnosis the script that make the failing and put in the appropriate timeout/error trapping to figure out why it's failing, can you explain me how can I proceed ?
Thanks again for your help ans this great soft Indigo !
Patrice

Posted on
Fri Dec 04, 2020 12:00 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Socket send() 55 error

Not without seeing the script. There are any number of ways to do network communication, each with different ways to deal with timeouts and errors.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Dec 04, 2020 12:10 pm
PME999 offline
Posts: 54
Joined: Jul 28, 2012

Re: Socket send() 55 error

Ok clear.
To find the wrong script is there a way to help me with indigo log or debugging tool ?
Thanks

Posted on
Fri Dec 04, 2020 1:03 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Socket send() 55 error

Look at your logs right before you see those socket errors to see what triggers/schedules/actions were executing. Usually the context provided by the log is enough to track things down.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Dec 13, 2020 8:43 am
PME999 offline
Posts: 54
Joined: Jul 28, 2012

Re: Socket send() 55 error

Jay
Just to keep you informed, I’ve finally found the failing script with a wrong IP address to make the sql query on my database. I finally take localhost instead of IP address to avoid any other problem

See below the example of script I’m doing to send data to my sql. I hope this is a acceptable code because I can have many of these small triggers at the same time (I’m doing my best but not coder )
Thanks for your support.
Patrice


Embedded script in Indigo with a trigger:
Code: Select all
import requests
var_value = indigo.variables[1456225636].value
the_url = "http://localhost:8888/logger7.php?f=STATUTPORTAILOUVERT&v={}".format(var_value)
requests.get(the_url)




And logger7.php code :
Code: Select all
<?php

$db_name  “xxxxx";
$db_login = "xxxxx";
$db_passw = "xxxxxxxx";
$db_table = "xxxxxxxx  ";

if (!isset($_GET['f']) || !isset($_GET['v']))
    die ("v or f is null");

$feed = $_GET['f'];
$value = $_GET['v'];

$db = mysql_connect('localhost', $db_login, $db_passw);
mysql_select_db($db_name, $db) or die('Erreur SQL !<br>'.mysql_error());

$sql = "CREATE TABLE IF NOT EXISTS " . $db_table . "(ffeed varchar(128), ftimestamp TIMESTAMP, fvalue DOUBLE)";
mysql_query($sql, $db) or die('Erreur SQL !<br>'.mysql_error());

$sql = "INSERT INTO ".$db_table." (ffeed, ftimestamp, fvalue) VALUES (\"".$feed."\", NOW(), ".$value.")";
mysql_query($sql, $db) or die('Erreur SQL !<br>'.mysql_error());

?>

Posted on
Mon Dec 14, 2020 11:21 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Socket send() 55 error

In order to avoid timeouts, you can make a simple change to your script which might avoid some issues:

Code: Select all
import requests
var_value = indigo.variables[1456225636].value
the_url = "http://localhost:8888/logger7.php?f=STATUTPORTAILOUVERT&v={}".format(var_value)
try:
    requests.get(the_url, timeout=5)  # Number of seconds to wait until throwing the error and continuing
except:
    # A timeout exception will be raised - you can do something here or just log an error or ignore
    indigo.server.log("Error communicating with XXXXXXX - connection timed out", isError=True)
    # If you just want to do nothing at all, just pass
    pass

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Dec 14, 2020 1:59 pm
PME999 offline
Posts: 54
Joined: Jul 28, 2012

Re: Socket send() 55 error

Many thanks Jay

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests