BlockingCall Aufruf bringt FHEM zu Absturz

Begonnen von CoolTux, 11 Juli 2017, 13:57:32

Vorheriges Thema - Nächstes Thema

CoolTux


2017.07.11 13:45:32 1: Timeout for XiaomiFlowerSens_BlockingRun reached, terminated process 25466
2017.07.11 13:45:32 3: (PflanzeFlur) Sub XiaomiFlowerSens_BlockingAborted - The BlockingCall Process terminated unexpectedly. Timedout
Can't kill a non-numeric process ID at FHEM/Blocking.pm line 267.
2017.07.11 13:45:33 1: BlockingInformParent (BlockingStart): Can't connect to localhost:7072: IO::Socket::INET: connect: Verbindungsaufbau abgelehnt
2017.07.11 13:45:33 1: BlockingInformParent (XiaomiFlowerSens_BlockingDone): Can't connect to localhost:7072: IO::Socket::INET: connect: Verbindungsaufbau abgelehnt
2017.07.11 13:45:34 1: BlockingInformParent (BlockingStart): Can't connect to localhost:7072: IO::Socket::INET: connect: Verbindungsaufbau abgelehnt
2017.07.11 13:45:34 1: BlockingInformParent (PRESENCE_ProcessLocalScan): Can't connect to localhost:7072: IO::Socket::INET: connect: Verbindungsaufbau abgelehnt


Wenn ich ein Notify anlege welches auf ein BlockingCall Timeout Event meines FlowerSense Modules reagiert und ich im Notify dafür Sorge das BlockingCall wieder aufgerufen wird dann bekomme ich die Meldung von oben und FHEM ist nicht mehr erreichbar.

Auf einem Testsystem ohne weitere Moduldefinitionen gibt es kein Problem/Absturz. Die Daten sind recht mau ich weiß, aber ich kann auch nicht ständig meine Produktivumgebung abschießen  ;D
Das System ist gerade eben upgedatet worden. Also aktuell. Dennoch selbiges Fehlerbild.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

rudolfkoenig

Leider kann ich keine der Meldungen aus den vorliegenden Informationen erklaeren, selbst nach eine halbe Stunde nachdenken/code-schauen/nachstellen (natuerlich ohne Xiomi) nicht.
Evtl. hilft mir ein "attr global verbose 4" Log, vom FHEM-Start bis zum Problemfall. Weiss nicht, ob das sinnvoll machbar ist.

CoolTux

Hallo Rudi,

Ich warte derzeit auf eine ruhige Stunde vor ich das ganze dann Mal testen und wegknallen kann. Im Moment finde ich leider nicht die Zeit. Ich bleibe aber dran. Danke für Deine Zeit zum überlegen.


Grüße
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

DS_Starter

Hallo Cooltux und Rudi,

ich habe auf einer meiner Testinstanzen immer mal wieder auch diesen beschriebenen Fehler inkl. Absturz. Der eigentlichen Ursache bin ich auch nicht auf die Spur gekommen und ist komischerweise auch nur auf einer meiner Instanzen aufgetreten.

Aber ich habe im Blocking.pm bei mir "if (looks_like_number($h->{pid}))" in die sub BlockingKill eingefügt um das Problem zu umgehen:


sub
BlockingKill($)
{
  my $h = shift;

  return if($h->{terminated});

  ...............

      }
      if (looks_like_number($h->{pid})) {
# 2017.05.09 20:09:57.098 1: SMAInverter MySTP_5000 -> BlockingCall getstatus_DoParse timed out
        # Can't kill a non-numeric process ID at FHEM/Blocking.pm line 237.
   InternalTimer(gettimeofday()+1, "BlockingStart", \%BC_hash, 0)
          if(kill(0, $h->{pid})); # Forum #58867
  } else {
    Log 1, "BlockingKill can't kill a non-numeric process ID: $h->{pid}";
  }

    }
  }
  BlockingStart();
}


Seitdem ist nichts mehr vorgekommen. Vllt. kann das in Blocking.pm übernommen werden.

viele Grüße
Heiko
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

rudolfkoenig

Das ist die "Problem unter dem Teppich kehren"-Methode. Bevor ich es uebernehme, wuerde ich gerne verstehen, was die Ursache ist. Wenn das bei euch auftritt, dann lieber vorher eine Ausgabe machen mit:
Log 1, "ERROR: Strange BlockingCall PID: >$h->{pid}<" if(!looks_like_number($h->{pid}));

DS_Starter

Habe es bei mir eingebaut. Melde mich wieder wenn der Absturz passiert.
Kann aber dauern ... passierte in der Vergangenheit nur ab und zu.

Grüße
Heiko
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

CoolTux

Wo genau muß die Ausgabe hin

Mein erster Versuch war nicht so toll

2017.07.17 10:20:03 1: Timeout for XiaomiFlowerSens_BlockingRun reached, terminated process 19140
2017.07.17 10:20:03 3: (PflanzeFlur) Sub XiaomiFlowerSens_BlockingAborted - The BlockingCall Process terminated unexpectedly. Timedout
Can't kill a non-numeric process ID at FHEM/Blocking.pm line 267.
2017.07.17 10:20:04 1: BlockingInformParent (BlockingStart): Can't connect to localhost:7072: IO::Socket::INET: connect: Verbindungsaufbau abgelehnt
2017.07.17 10:20:04 1: BlockingInformParent (XiaomiFlowerSens_BlockingDone): Can't connect to localhost:7072: IO::Socket::INET: connect: Verbindungsaufbau abgelehnt


my $h = shift;

  return if($h->{terminated});

  if($^O !~ m/Win/) {
    if($h->{pid} && $h->{pid} !~ m/:/ && kill(9, $h->{pid})) {
      Log 1, "Timeout for $h->{fn} reached, terminated process $h->{pid}";
      if($h->{abortFn}) {
        no strict "refs";
        my $ret = &{$h->{abortFn}}($h->{abortArg});
        use strict "refs";

      } elsif($h->{finishFn}) {
        no strict "refs";
        my $ret = &{$h->{finishFn}}();
        use strict "refs";

      }
      InternalTimer(gettimeofday()+1, "BlockingStart", \%BC_hash, 0)
        if(kill(0, $h->{pid})); # Forum #58867
    }

        # Zusaetzliche Ausgabe wegen FHEM tot
        Log 1, "ERROR: Strange BlockingCall PID: >$h->{pid}<" if(!looks_like_number($h->{pid}));


  }
............

Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

DS_Starter

Ich habe es bei mir vor

InternalTimer(gettimeofday()+1, "BlockingStart", \%BC_hash, 0)
        if(kill(0, $h->{pid})); # Forum #58867

Gesetzt. Sollte passen denke ich.

VG
Heiko
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

CoolTux

Tada
Hoffe das hilft ein bisschen.


2017.07.17 10:50:50 1: Timeout for XiaomiFlowerSens_BlockingRun reached, terminated process 20721
2017.07.17 10:50:50 3: (PflanzeFlur) Sub XiaomiFlowerSens_BlockingAborted - The BlockingCall Process terminated unexpectedly. Timedout
2017.07.17 10:50:50 1: ERROR: Strange BlockingCall PID: >DEAD:20721<
Can't kill a non-numeric process ID at ./FHEM/Blocking.pm line 268.
2017.07.17 10:50:51 1: BlockingInformParent (BlockingStart): Can't connect to localhost:7072: IO::Socket::INET: connect: Verbindungsaufbau abgelehnt
2017.07.17 10:50:51 1: BlockingInformParent (XiaomiFlowerSens_BlockingDone): Can't connect to localhost:7072: IO::Socket::INET: connect: Verbindungsaufbau abgelehnt
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

rudolfkoenig

Ja, ich habe jetzt die looks_like_number Pruefung eingebaut/eingecheckt.
Offensichtlich wird im AbortFn/FinishFn ein BlockingCall aufgerufen, wo die pid als "bereits verstorben" markiert wird.

CoolTux

Ich danke Dir Rudi. Und auch Dir besten Dank Tobias. Ich werde morgen ein Update machen und dann noch einmal testen.


Grüße
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

DS_Starter

ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

CoolTux

Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net