73_PRESENCE.pm -- Log "Timeout for PRESENCE_DoLocalBluetoothScan reached"

Begonnen von kadettilac89, 09 November 2017, 21:35:53

Vorheriges Thema - Nächstes Thema

kadettilac89

Hallo,

ich habe Presence mit Option "local-bluetooth" aktiviert. Seitdem habe ich jede Minute den Logeintrag.


Timeout for PRESENCE_DoLocalBluetoothScan reached, terminated process 15275


Frage ist hauptsächlich an den Modulentwickler  Markus Bloch.

Mein Handy ist zum Zeitpunkt des Logeintrags nicht erreichbar, darum scheint die Prüfung nicht normal zu terminieren und dann halt gekillt wird. Mir fehlt hier der Hintergrund der Blocking-Funktion. Btw.: Ist es überhaupt eine Fehlersituation wenn die Sub "PRESENCE_Undef($$)" gerufen wird? Hier wird BlockingKill gerufen die dann den Logeintrag erzeugt.

Da der Log in einer includierten Funktion erzeugt wird, ist auch mein Versucht "verbose 0" vermutlich erfolglos.

Eine Bitte, wäre es möglich den Loglevel für diese Meldung auf > 1 zu ändern? Vielleicht liegt es auch an Stretch dass hier der Prozess nicht beendet wird.

Mögliche Korrektur:

Modul 73_PRESENCE.pm, Zeile 643

        if($mode eq "local-bluetooth")
        {
            Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode local-bluetooth";
            $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalBluetoothScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "bluetooth_hci_device", ""), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);

>>>>>>>>>        $hash->{helper}{RUNNING_PID}->{loglevel} = 3;      <<<<<<<<<<< Zeile neu

}


Hintergrund der Änderung:
In Blocking.pm wird hier per Default der Loglevel 1 gesetzt wenn nicht explizit was anderes gesetzt wird (was ich oben eingefügt habe). Möglicherweise kam hier eine Änderung der Logpriorität durch "# Forum #77057 " rein nachdem das Presence Modul erstellt wurde.

https://forum.fhem.de/index.php/topic,77057.msg689918.html#msg689918


BlockingKill($)
{
  my $h = shift;

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

  if($^O !~ m/Win/) {
    if($h->{pid} && $h->{pid} !~ m/:/ && kill(9, $h->{pid})) {
     
<<< hier wird Loglevel 1 gesetzt (als default) >>>
>>>>      my $ll = (defined($h->{loglevel}) ? $h->{loglevel} : 1); # Forum #77057   <<<<<<<<

      Log $ll, "Timeout for $h->{fn} reached, terminated process $h->{pid}";



Ich hoffe es verständlich genug gepostet zu haben. Wenn nicht bitte nachfragen ....

Vielen Dank im Voraus.

Ich habe jetzt erstmal die Änderung drin damit ich keine Logs mehr habe.

List meiner Definition ...

Internals:
   ADDRESS  E0:XX:XX:XX:XX:XX
   CHANGED
   DEF        local-bluetooth E0:XX:XX:XX:XX:XX
   MODE       local-bluetooth
   NAME       pres_S6BT
   NOTIFYDEV  global
   NR         698
   NTFY_ORDER 50-pres_S6BT
   STATE      timeout
   TIMEOUT_NORMAL 30
   TIMEOUT_PRESENT 30
   TYPE       PRESENCE
   READINGS:
     2017-11-09 20:50:56   model           local-bluetooth
     2017-11-09 18:12:21   presence        absent
     2017-11-09 21:21:14   state           timeout
   helper:
     ABSENT_COUNT 0
     PRESENT_COUNT 0
     RETRY_COUNT 26
     RUNNING_PID:
       abortFn    PRESENCE_ProcessAbortedScan
       arg        pres_S6BT|E0:XX:XX:XX:XX:XX|0|
       bc_pid     92
       finishFn   PRESENCE_ProcessLocalScan
       fn         PRESENCE_DoLocalBluetoothScan
       pid        25704
       telnet     telnetPort_127.0.0.1_38122
       timeout    60
       abortArg:
Attributes:
   DbLogExclude .*
   alias      S6BT
   devStateIcon absent:message_presence_disabled timeout:message_presence_disabled present:message_presence
   event-on-change-reading state
   group      Home Status
   icon       it_smartphone
   room       Status
   verbose    0

Otto123

Hi,

diese Meldungen habe ich auch. Sie treten erst auf, wenn ich mehr als 2 dieser PRESENCE Definitionen habe. Derzeit sind es in Summe 4.
Ich konnte die Anzahl dieser Meldungen reduzieren, indem ich die Scanintervalle gestaffelt habe.
10 60
12 60
14 60
16 60
2017.11.06 13:53:35 1: Timeout for PRESENCE_DoLocalBluetoothScan reached, terminated process 16588
2017.11.06 13:53:35 2: PRESENCE (BT_iBrina) - device could not be checked (retrying in 10 seconds)
2017.11.06 13:53:53 2: PRESENCE (BT_iBrina) - check returned a valid result after 1 unsuccesful retry
2017.11.07 10:32:03 1: Timeout for PRESENCE_DoLocalBluetoothScan reached, terminated process 25740
2017.11.07 10:32:03 2: PRESENCE (BT_iRon) - device could not be checked (retrying in 10 seconds)
2017.11.07 10:32:24 2: PRESENCE (BT_iRon) - check returned a valid result after 1 unsuccesful retry
2017.11.07 19:10:33 1: Timeout for PRESENCE_DoLocalBluetoothScan reached, terminated process 24423
2017.11.07 19:10:33 2: PRESENCE (BT_iRon) - device could not be checked (retrying in 10 seconds)
2017.11.07 19:10:48 2: PRESENCE (BT_iRon) - check returned a valid result after 1 unsuccesful retry
2017.11.09 09:16:02 1: Timeout for PRESENCE_DoLocalBluetoothScan reached, terminated process 504
2017.11.09 09:16:02 2: PRESENCE (BT_Nexus5) - device could not be checked (retrying in 10 seconds)
2017.11.09 09:16:25 2: PRESENCE (BT_Nexus5) - check returned a valid result after 1 unsuccesful retry
2017.11.09 14:23:51 1: Timeout for PRESENCE_DoLocalBluetoothScan reached, terminated process 9841
2017.11.09 14:23:51 2: PRESENCE (BT_iRon) - device could not be checked (retrying in 10 seconds)
2017.11.09 14:24:21 2: PRESENCE (BT_iRon) - check returned a valid result after 1 unsuccesful retry


Es ist nicht so wahnsinnig wichtig, aber wenn ich was beitragen kann  :D

Gruß Otto
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz