neues modul mailcheck

Begonnen von justme1968, 02 August 2013, 19:08:55

Vorheriges Thema - Nächstes Thema

Marlen

Das hab ich mir auch schon mal gedacht, aber wie kann ich zumindest die Fehlermeldung unterbinden?

Verbose 0 bringt auch die Fehler!

LG
  Marlen

Benni

Zitat von: Marlen am 19 Juni 2017, 21:41:26
aber wie kann ich zumindest die Fehlermeldung unterbinden?

Wieso denn?
Bei mir tritt das auch sporadisch auf. Mit der Meldung im Log kann ich leben. Ich will ja schließlich keinen Schönheitspreis für das fehlerfreiste Logfile gewinnen  ;)

Marlen

Naja, weil ich so den überblick verliere und nur "echte" Fehler sehen will!

Und die Fehlermeldung kommt ja immer gleich 20x und immer 8 Zeilen!

Ich denke mir Verbose 0 kann man das abstellen!

LG
  Marlen

Bednorz

Hallo,
ich hab leider ein kleines Problem mit mailcheck und wollte mal fragen, ob jemand eine Idee hätte woran es liegen könnte. Das Problem an sich wurde hier schonmal vom User pschlaeppi gestellt, aber scheinbar nicht beantwortet. Deswegen nochmal das Problem: Das reading "Subject" wird nicht erzeugt obwohl alles andere normal funktioniert.
Stand ist der, dass der Server ein lokaler MailServer bei mir zu Hause ist. Die Software heißt hMailServer.Das mailcheck-Modul läuft mir nossl = 1 Hier noch die Internals des mailcheck-Moduls:


CONNECTS                    4
DEF                               imap.xxxxx.yyyyy zzzzzzz@.xxxxx.yyyyy aaaaaaaa
FD                                 87
Folder                           INBOX
HAS_GPG                      0
HAS_IDLE                      1
HAS_MIME                    1
Host                              imap.xxxxx.yyyyy
INTERVAL                      600
LAST_CONNECT            2017-09-28 13:51:36
LAST_DISCONNECT      2017-09-28 13:51:36
LAST_LOGIN                 2017-09-28 13:51:36
LAST_POLL                   2017-09-28 14:01:36
NAME                           CameraCheck
NOTIFYDEV                   global
NR                                245
NTFY_ORDER                50-CameraCheck
STATE                           Logged in
TYPE                             mailcheck
currentlogfile                ./log/09-CameraCheck.log
tag                               31


Ich habe noch Debugging aktiviert und bekomme diese Meldung:


ERROR: message_string() expected 392321 bytes but received 392356 you may need the IgnoreSizeErrors option at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 870
Mail::IMAPClient::message_string('Mail::IMAPClient=HASH(0x1a39958)', 19) called at ./FHEM/32_mailcheck.pm line 405
main::mailcheck_Read('HASH(0x13aed30)') called at fhem.pl line 3448
main::CallFn('CameraCheck', 'ReadFn', 'HASH(0x13aed30)') called at fhem.pl line 692
2017-09-28_14:16:52 CameraCheck From: vvvvvvvv@.xxxxx.yyyyy


Ich habe die Aktion, die in der obigen Meldung empfohlen wird noch nicht durchgeführt, weil ich nichtmal weiß, ob diese Meldung irgendwas mit meinem Problem zu tun hat. Sollte noch eine Info fehlen einfach Bescheid sagen. Schonmal Danke im voraus fürs Helfen.

mfG Bednorz

Raemsna

Zitat von: Marlen am 20 Juni 2017, 07:32:22
Naja, weil ich so den überblick verliere und nur "echte" Fehler sehen will!

Und die Fehlermeldung kommt ja immer gleich 20x und immer 8 Zeilen!

Ich denke mir Verbose 0 kann man das abstellen!

LG
  Marlen


Ich möchte dieses Thema gerne nochmal aufgreifen.
Bei mir ist es 1x täglich so, dass aufgrund eines Provider DSL disconnects das Modul mailcheck dieselbe Fehlermeldung bringt, wie bei Marlen.

Das ist leider ärgerlich, weil auch ich so den Überblick über das Filelog verliere.

Wenn das im Modul nicht zu unterbinden ist (verbose 0 ist auch bei mir aktiviert), dann wäre ein Tipp sehr hilfreich, wie man das ggf. im Code des Moduls selbst anpassen kann.

Vielen Vielen Dank für die tolle Arbeit und Unterstützung!!

Grüße
Raemsna

Bednorz

Konnte mein Problem inzwischen alleine lösen. Habe die Lösung hier ins Forum unter folgendes Thema geschrieben:

"Modul mailcheck erzeugt "Subject" Reading nicht"

mfG Bednorz

Wuehler

Hallo,
erstmal wieder ein Danke für das Modul. War wieder einfach einzubinden :-)
Für meinen Anwendungsfall brauchte ich auch den Body der Mails, daher eine kleine Erweiterung, die zumindest mit reinen Textmails zurechtkommt.

my $body = $client->body_string($resp);
...
readingsBulkUpdate($hash, "Body", $body);


Umlaute/GPG sehen damit nicht schön aus. War mir aber erstmal egal, da beides in meinem Anwendungsfall nicht vorkommt.

Welche Probleme werden denn beim Body gesehen? Vielleicht kann/darf ich das Thema ja mal angehen :)

VG,
Der Wuehler

Raemsna

Zitat von: Raemsna am 03 Oktober 2017, 18:34:32

Ich möchte dieses Thema gerne nochmal aufgreifen.
Bei mir ist es 1x täglich so, dass aufgrund eines Provider DSL disconnects das Modul mailcheck dieselbe Fehlermeldung bringt, wie bei Marlen.

Das ist leider ärgerlich, weil auch ich so den Überblick über das Filelog verliere.

Wenn das im Modul nicht zu unterbinden ist (verbose 0 ist auch bei mir aktiviert), dann wäre ein Tipp sehr hilfreich, wie man das ggf. im Code des Moduls selbst anpassen kann.

Vielen Vielen Dank für die tolle Arbeit und Unterstützung!!

Grüße
Raemsna

Servus zusammen,

auf die Gefahr hin, dass ich nerve (aber mein FHEM LOG ist wirklich schlimm lesbar, weil das mailcheck Modul mir das Log vollmacht, sobald die Verbindung weg ist):

Gibt es eine Möglichkeit diese Fehler in ein Logfile zu schreiben oder überhaupt nicht zu loggen?

Wenn jemand einen Tipp hat, wie ich das auch selbständig im Modul per Code ändern kann, freue ich mich ebenfalls sehr... :)
Vielen Dank und Liebe Grüße
Raemsna

2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1545
Mail::IMAPClient::_send_line('Mail::IMAPClient=HASH(0x54518c0)', '459 SELECT INBOX', 0) called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1321
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x54518c0)', 'SELECT INBOX') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'SELECT INBOX') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 846
Mail::IMAPClient::select('Mail::IMAPClient=HASH(0x54518c0)', 'INBOX') called at ./FHEM/32_mailcheck.pm line 275
main::mailcheck_poll(undef) called at fhem.pl line 3035
main::HandleTimeout() called at fhem.pl line 620
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'Error sending \'459 SELECT INBOX\': NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1322
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x54518c0)', 'SELECT INBOX') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'SELECT INBOX') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 846
Mail::IMAPClient::select('Mail::IMAPClient=HASH(0x54518c0)', 'INBOX') called at ./FHEM/32_mailcheck.pm line 275
main::mailcheck_poll(undef) called at fhem.pl line 3035
main::HandleTimeout() called at fhem.pl line 620
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: Error sending '459 SELECT INBOX': NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'Error sending \'459 SELECT INBOX\': NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1275
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'SELECT INBOX') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 846
Mail::IMAPClient::select('Mail::IMAPClient=HASH(0x54518c0)', 'INBOX') called at ./FHEM/32_mailcheck.pm line 275
main::mailcheck_poll(undef) called at fhem.pl line 3035
main::HandleTimeout() called at fhem.pl line 620
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1545
Mail::IMAPClient::_send_line('Mail::IMAPClient=HASH(0x54518c0)', '460 IDLE', 0) called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1321
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1119
Mail::IMAPClient::idle('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 276
main::mailcheck_poll(undef) called at fhem.pl line 3035
main::HandleTimeout() called at fhem.pl line 620
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'Error sending \'460 IDLE\': NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1322
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1119
Mail::IMAPClient::idle('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 276
main::mailcheck_poll(undef) called at fhem.pl line 3035
main::HandleTimeout() called at fhem.pl line 620
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: Error sending '460 IDLE': NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'Error sending \'460 IDLE\': NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1275
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1119
Mail::IMAPClient::idle('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 276
main::mailcheck_poll(undef) called at fhem.pl line 3035
main::HandleTimeout() called at fhem.pl line 620
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: Error sending '460 IDLE': NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1617
Mail::IMAPClient::_read_line('Mail::IMAPClient=HASH(0x54518c0)') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1393
Mail::IMAPClient::_get_response('Mail::IMAPClient=HASH(0x54518c0)', '*', 'Regexp=REGEXP(0x51a87c0)') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1143
Mail::IMAPClient::idle_data('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 378
main::mailcheck_Read('HASH(0x4a982a0)') called at fhem.pl line 3448
main::CallFn('Mailcheck_GMX.net', 'ReadFn', 'HASH(0x4a982a0)') called at fhem.pl line 692
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1545
Mail::IMAPClient::_send_line('Mail::IMAPClient=HASH(0x54518c0)', 'DONE', 0) called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1321
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x54518c0)', 'HASH(0x6b11c50)', 'DONE') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'HASH(0x6b11c50)', 'DONE') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1168
Mail::IMAPClient::done('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 382
main::mailcheck_Read('HASH(0x4a982a0)') called at fhem.pl line 3448
main::CallFn('Mailcheck_GMX.net', 'ReadFn', 'HASH(0x4a982a0)') called at fhem.pl line 692
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'Error sending \'DONE\': NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1322
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x54518c0)', 'HASH(0x6b11c50)', 'DONE') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'HASH(0x6b11c50)', 'DONE') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1168
Mail::IMAPClient::done('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 382
main::mailcheck_Read('HASH(0x4a982a0)') called at fhem.pl line 3448
main::CallFn('Mailcheck_GMX.net', 'ReadFn', 'HASH(0x4a982a0)') called at fhem.pl line 692
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: Error sending 'DONE': NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'Error sending \'DONE\': NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1275
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'HASH(0x6b11c50)', 'DONE') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1168
Mail::IMAPClient::done('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 382
main::mailcheck_Read('HASH(0x4a982a0)') called at fhem.pl line 3448
main::CallFn('Mailcheck_GMX.net', 'ReadFn', 'HASH(0x4a982a0)') called at fhem.pl line 692
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1545
Mail::IMAPClient::_send_line('Mail::IMAPClient=HASH(0x54518c0)', '462 IDLE', 0) called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1321
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1119
Mail::IMAPClient::idle('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 483
main::mailcheck_Read('HASH(0x4a982a0)') called at fhem.pl line 3448
main::CallFn('Mailcheck_GMX.net', 'ReadFn', 'HASH(0x4a982a0)') called at fhem.pl line 692
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'Error sending \'462 IDLE\': NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1322
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1119
Mail::IMAPClient::idle('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 483
main::mailcheck_Read('HASH(0x4a982a0)') called at fhem.pl line 3448
main::CallFn('Mailcheck_GMX.net', 'ReadFn', 'HASH(0x4a982a0)') called at fhem.pl line 692
2017.12.23 07:26:41 1: PERL WARNING: Trying command when NOT connected! LastError was: Error sending '462 IDLE': NO not connected at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 122
Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x54518c0)', 'Error sending \'462 IDLE\': NO not connected') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1275
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x54518c0)', 'IDLE', '+') called at /usr/local/share/perl/5.14.2/Mail/IMAPClient.pm line 1119
Mail::IMAPClient::idle('Mail::IMAPClient=HASH(0x54518c0)') called at ./FHEM/32_mailcheck.pm line 483
main::mailcheck_Read('HASH(0x4a982a0)') called at fhem.pl line 3448
main::CallFn('Mailcheck_GMX.net', 'ReadFn', 'HASH(0x4a982a0)') called at fhem.pl line 692

conmarti

Hallo zusammen,

ich habe für dieses Problem:
Zitat von: Lichti am 24 Januar 2017, 09:43:44
Zu dem Problem mit "Bizarre copy" und FHEM-Absturz gibt es hier eine Lösung:
https://forum.fhem.de/index.php/topic,47457.0.html

Hilft zumindest gegen den Absturz bei der nächtlichen DSL-Zwangstrennung.
Fällt allerdings tagsüber die Internetverbindung aus, bleibt das Problem.
Hier bin ich auch noch am suchen nach einer Lösung.

vermutliche die Ursache gefunden. Siehe https://forum.fhem.de/index.php/topic,47457.msg737398.html#msg737398

Gruß Conny

Wuehler

Hi,

das Problem ist damit ein wenig lokalisiert, aber noch nicht gelöst. Ich habe mir darüber mal ein paar Gedanken gemacht, leider reichen meine perl-Kenntnisse zum Verstehen noch nicht aus  :-[

Kannst du mal die mailcheck_poll ersetzen durch folgenden code:
sub
mailcheck_poll($)
{
  my ($hash) = @_;

  # Falls in der Zwischenzeit disconnected wird,
  # dann wird der hash des clients durch den client-hash im übergebenen hash überschrieben
  # und dann durch RemoveInternalTimer kompromitiert. Wie genau verstehe ich auch nicht ;-)
  my $client = $hash->{CLIENT};
  if( ! $client && $client->IsConnected) {
    mailcheck_Connect($hash);
  }
 
  RemoveInternalTimer($hash);
  InternalTimer(gettimeofday()+$hash->{INTERVAL}, "mailcheck_poll", $hash, 0);

  $client = $hash->{CLIENT};
  if( $client && $client->IsConnected && $client->IsAuthenticated ) {
    $client->done;
    $client->select($hash->{Folder});
    $hash->{tag} = $client->idle;
    $hash->{LAST_POLL} = FmtDateTime( gettimeofday() );
  }
}


Aktuell sollte dein auskommentieren von RemoveInternalTimer keine Nebenwirkungen haben. Bei einer Weiterentwicklung des Moduls könnte es hier aber zu Problemen kommen.
Was meint denn der Modulautor dazu?

Viele Grüße
Dirk


conmarti

Hallo,

das Problem (Absturz von FHEM) ist damit meiner Meinung nach schon gelöst. Über das andere Problem(mailcheck "verliert" die Verbindung zum Mailserver) habe ich mir auch schon Gedanken gemacht. Aktuell sieht die Funktion mailcheck_poll bei mir so aus:

sub
mailcheck_poll($)
{
  my ($hash) = @_;
  my $name   = $hash->{NAME};
  my $client = $hash->{CLIENT};
  if( $client && $client->IsConnected && $client->IsAuthenticated ) {
    if (!($client->done() && $client->select($hash->{Folder}) && ($hash->{tag} = $client->idle()) )) {
      mailcheck_Disconnect($hash);
      mailcheck_Connect($hash);
    } else {
      $hash->{LAST_POLL} = FmtDateTime( gettimeofday() );
      InternalTimer(gettimeofday()+$hash->{INTERVAL}, "mailcheck_poll", $hash, 0);
    }
  } else {
    mailcheck_Disconnect($hash);
    mailcheck_Connect($hash);
  }
}



Wobei ich vermute, dass der letzte else-Zweig eh nie zum tragen kommt.

Um wirklich sicherzugehen, dass das RemoveInternalTimer das Problem ist, habe ich mir ein kleines "Dummy"-Modul gebaut. Siehe Anhang.

define DT DummyTimer 3

definiert eine Instanz dieses Moduls, welches nichts anderes tut, als über einen "InternalTimer" den Zustand alle 3 Sekunden zu ändern.

attr DT verbose 4

aktiviert ein paar Logausgaben, wo man sieht, dass ein RemoveInternalTimer den Stack "zerstört".

attr DT useRemoveInternalTimer yes

schaltet die Verwendung von RemoveInternalTimer ein. Das führt dann bei mir innerhalb weniger Sekunden zum Absturz des fhem.pl Prozesses.


Gruß Conny

Wuehler

Welche Meldung erwartest du dabei im Log? Bei mir kommt

2018.01.03 17:48:34 3: panic: attempt to copy freed scalar 49ac8d8 to 4b1f018 at /usr/lib/arm-linux-gnueabihf/perl/5.20/Data/Dumper.pm line 595.

und danach eine Reihe weiterer Ausgaben.

Wenn ich den anderen Thread lese, hat das auch etwas mit der genutzten perl-Version zu tun.

Der imap-Client bietet eine Funktion reconnect.
Könnte man die nicht nutzen und mailcheck_poll folgendermaßen umbauen:
sub
mailcheck_poll($)
{
  my ($hash) = @_;

  RemoveInternalTimer($hash);
  InternalTimer(gettimeofday()+$hash->{INTERVAL}, "mailcheck_poll", $hash, 0);

  my $client = $hash->{CLIENT}->reconnect;
  if (defined $client){
    if( $client && $client->IsConnected && $client->IsAuthenticated ) {
      $client->done;
      $client->select($hash->{Folder});
      $hash->{tag} = $client->idle;
      $hash->{LAST_POLL} = FmtDateTime( gettimeofday() );
    }
  }else{
    mailcheck_Disconnect($hash);
    $hash->{STATE} = "Initialized";
    mailcheck_Connect($hash);
  }
}

conmarti

ein "erfolgreicher" Absturz sieht bei mir so aus.


2018.01.03 14:34:42.646 3: $VAR1 = {
          'CFGFN' => '',
          'DEF' => '3',
          'NAME' => 'DT',
          'NR' => 107,
          'READINGS' => {
                          'state' => {
                                       'TIME' => '2018-01-03 14:34:39',
                                       'VAL' => 'on'
                                     }
                        },
          'STATE' => 'on',
          'TYPE' => 'DummyTimer',
          'interval' => 3,
          'name' => 'DT'
        };

2018.01.03 14:34:42.647 3: panic: attempt to copy freed scalar 3318c00 to 339ca10 at /usr/lib/arm-linux-gnueabihf/perl/5.20/Data/Dumper.pm line 595.

2018.01.03 14:34:42.658 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer("main") called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:42.662 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer("Carp::shortmess") called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:42.665 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(undef) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:42.670 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer("./FHEM/98_DummyTimer.pm") called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:42.675 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer("") called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:42.681 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 5) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(1) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

Bizarre copy of ARRAY in list assignment at /usr/share/perl/5.20/Carp.pm line 228.


Was man hier auch gut sieht, ist der korrupte Stack. In den Zeilen "main::DummyTimer_OnTimer(.......) called at fhem.pl line 3064" ist der übergabeparameter jedesmal ein anderer.
Wenn RemoveInternalTimer nicht aufgerufen wird, dann sehen die Zeile bei jeder Ausgabe des Stacks gleich aus.
main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064

2018.01.03 14:34:30.359 3: $VAR1 = {
          'CFGFN' => '',
          'DEF' => '3',
          'NAME' => 'DT',
          'NR' => 107,
          'READINGS' => {
                          'state' => {
                                       'TIME' => '2018-01-03 14:34:27',
                                       'VAL' => 'on'
                                     }
                        },
          'STATE' => 'on',
          'TYPE' => 'DummyTimer',
          'interval' => 3,
          'name' => 'DT'
        };

2018.01.03 14:34:30.361 3: $VAR1 = {
          'CFGFN' => '',
          'DEF' => '3',
          'NAME' => 'DT',
          'NR' => 107,
          'READINGS' => {
                          'state' => {
                                       'TIME' => '2018-01-03 14:34:27',
                                       'VAL' => 'on'
                                     }
                        },
          'STATE' => 'on',
          'TYPE' => 'DummyTimer',
          'interval' => 3,
          'name' => 'DT'
        };

2018.01.03 14:34:30.373 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.377 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.381 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.386 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.392 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.398 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 5) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.405 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 4) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 5) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.413 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 3) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 4) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 5) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.421 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 2) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 3) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 4) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 5) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.427 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 1) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 2) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 3) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 4) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 5) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

2018.01.03 14:34:30.433 4: DummyTimer_Process ... at ./FHEM/98_DummyTimer.pm line 96.
        main::DummyTimer_Process(HASH(0x1c23808), 0) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 1) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 2) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 3) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 4) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 5) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 6) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 7) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 8) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 9) called at ./FHEM/98_DummyTimer.pm line 97
        main::DummyTimer_Process(HASH(0x1c23808), 10) called at ./FHEM/98_DummyTimer.pm line 109
        main::DummyTimer_OnTimer(HASH(0x1c23808)) called at fhem.pl line 3064
        main::HandleTimeout() called at fhem.pl line 615

Auch gut zu sehen, dass das zweite Ausgeben des Übergabeparameters via Dumper(@_) erfolgreich ist. Denn ohne weitere Vorkehrungen (eval { }) würde FHEM schon an dieser Stelle mit der Meldung "panic: attempt to copy freed ......." abstürzen.

Zum Thema reconnect:
Das Modul mailcheck stellt den Socket zur Kommunikation mit dem IMAP-Server selbst zur Verfügung. Das verhindert die Nutzung von reconnect. Ein Versuch mit eine Testprogramm bestätigt das.

Use of uninitialized value $_[1] in join or string at /usr/share/perl5/Mail/IMAPClient.pm line 78.
reconnecting to , last error: timeout waiting 8s for data from server
Use of uninitialized value $sockargs[1] in join or string at /usr/share/perl5/Mail/IMAPClient.pm line 360.
Connecting with IO::Socket::INET PeerAddr  PeerPort 143 Proto tcp Timeout 8 Debug 1
Use of uninitialized value $server in concatenation (.) or string at /usr/share/perl5/Mail/IMAPClient.pm line 370.
ERROR: Unable to connect to : timeout waiting 8s for data from server at /usr/share/perl5/Mail/IMAPClient.pm line 370.
        Mail::IMAPClient::connect(Mail::IMAPClient=HASH(0x12e9310)) called at /usr/share/perl5/Mail/IMAPClient.pm line 1190
        Mail::IMAPClient::reconnect(Mail::IMAPClient=HASH(0x12e9310)) called at /opt/fhem/imaptest.pl line 21


Eventuell könnte man das umbauen und das Socket-Handling von Mail::IMAPClient machen lassen. Jedoch besteht die Gefahr, dass FHEM damit nicht zurechtkommt, da ja der Socket innerhalb FHEM genutzt wird um "sofort" auf eingehende Nachrichten reagieren zu können. Ich denke der Autor des Moduls hat nicht umsonst diesen Weg gewählt.

Gruß Conny

dennis_n

Hi,

ich bin auf der Suche nach einer Möglichkeit mit fhem den Betreff einer eMail auszuwerten entsprechend darauf zu reagieren.
Ginge das mit dem Modul?

Also sagen wir ich habe eine eigene Mailbox wo nur 3 emails mit unterschiedlichem Betreff zugelassen sind (Betreff: Test1, Betreff: Test2 und Betreff: Test3) und ich möchte das fhem diese Mailbox immer prüft und bei entsprechendem Betreff reagiert.

Also quasi ein doif mit den entsprechenden Anweisungen. Geht das zuverlässig?

Danke

Gruss
Dennis

Amenophis86

Ähm hast du die Posts hier im Thread vor deiner Frage mal gelesen?
Aktuell dabei unser neues Haus mit KNX am einrichten. Im nächsten Schritt dann KNX mit FHEM verbinden. Allein zwei Dinge sind dabei selten: Zeit und Geld...