DbRep: delDoublets delete -> Process died prematurely

Begonnen von tom2966, 05 September 2021, 19:38:49

Vorheriges Thema - Nächstes Thema

tom2966

Hallo,
ich habe folgendes Problem: Um doppelte Datensätze aus meiner DBLog zu löchen (keine Ahnung warum ich die habe, sind Homematic IP Devices mit HMCCU auf einem extra Raspberry mit PiVccu- das gucke ich mir als nächstes an bzw. der Primary Key wird eingeführt)) will ich DbRep nutzen. Die Datenbank ist eine SQLite Datenbank. Hier das List:

Internals:
   COLUMNS    field length used for Device: 64, Type: 64, Event: 0, Reading: 64, Value: 128, Unit: 32
   CONFIGURATION /opt/fhem/db.conf
   DEF        /opt/fhem/db.conf .*:.*
   FUUID      5c55c02f-f33f-fa12-0a99-6a9fd59e7fa61074
   FVERSION   93_DbLog.pm:v4.12.3-s24440/2021-05-15
   MODE       asynchronous
   MODEL      SQLITE
   NAME       DBLOG
   NR         33
   NTFY_ORDER 50-DBLOG
   PID        470
   REGEXP     .*:.*
   SQLITECACHESIZE 4000
   SQLITEWALMODE on
   STATE      connected
   TYPE       DbLog
   dbconn     SQLite:dbname=/opt/fhem/fhem.db
   dbuser     
   HELPER:
     COLSET     1
     DEVICECOL  64
     EVENTCOL   0
     OLDSTATE   connected
     PACKAGE    main
     READINGCOL 64
     TC         current
     TH         history
     TYPECOL    64
     UNITCOL    32
     VALUECOL   128
     VERSION    4.12.3
   READINGS:
     2021-09-05 19:23:44   CacheOverflowLastNum 0
     2021-09-03 21:35:32   CacheOverflowLastState normal
     2021-09-05 19:23:44   CacheUsage      0
     2021-09-05 19:23:44   NextSync        2021-09-05 19:24:14 or if CacheUsage 500 reached
     2017-10-01 15:44:30   countCurrent    0
     2018-01-22 21:34:45   countHistory    15590935
     2021-09-05 19:23:44   state           connected
Attributes:
   DbLogExclude .*
   asyncMode  1
   cacheLimit 500
   colEvent   0
   room       System


Der Befehl delDoublets adviceDelete bringt auch die Readings mit den zu löschenden Datensätzen, bis dahin alles ok. Um zu große Datenmengen zu vermeiden habe ich auch mit den Timestamp- Attributen und dem Device Attribut die Auswahl eingegrenzt. Das List dazu:

Internals:
   DATABASE   /opt/fhem/fhem.db
   DEF        DBLOG
   FUUID      5c55c030-f33f-fa12-431b-89187c8e58a0ddd9
   FVERSION   93_DbRep.pm:v8.42.8-s24770/2021-07-18
   LASTCMD    delDoublets adviceDelete
   MODEL      Client
   NAME       Daten
   NOTIFYDEV  global,Daten
   NR         35
   NTFY_ORDER 50-Daten
   ROLE       Client
   STATE      done
   TYPE       DbRep
   UTF8       0
   HELPER:
     DBLOGDEVICE DBLOG
     IDRETRIES  2
     MINTS      201%-04-02 03:15:16
     PACKAGE    main
     SQLHIST   
     VERSION    8.42.8
     CV:
       aggregation day
       aggsec     86400
       destr      2021-09-05
       dsstr      2021-09-05
       epoch_seconds_end 1630879199
       mestr      09
       msstr      09
       testr      23:59:59
       tsstr      00:00:00
       wdadd     
       yestr      2021
       ysstr      2021
     DBREPCOL:
       COLSET     1
       DEVICE     64
       EVENT      0
       READING    64
       TYPE       64
       UNIT       32
       VALUE      128
   OLDREADINGS:
   READINGS:
     2021-09-05 18:59:13   2021-09-05_01-05-18__0_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.9_|_1
     2021-09-05 18:59:13   2021-09-05_01-05-18__1_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_01-05-18__2_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_02-22-28__3_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.9_|_1
     2021-09-05 18:59:13   2021-09-05_02-22-28__4_EG_Bad_Heizung__1.HUMIDITY 63_|_1
     2021-09-05 18:59:13   2021-09-05_02-22-28__5_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_02-50-48__6_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_02-50-48__7_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_04-09-35__10_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_04-09-35__8_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.8_|_1
     2021-09-05 18:59:13   2021-09-05_04-09-35__9_EG_Bad_Heizung__1.HUMIDITY 63_|_1
     2021-09-05 18:59:13   2021-09-05_04-37-50__11_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.8_|_1
     2021-09-05 18:59:13   2021-09-05_04-37-50__12_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_04-37-50__13_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_04-49-20__14_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.7_|_1
     2021-09-05 18:59:13   2021-09-05_04-49-20__15_EG_Bad_Heizung__1.HUMIDITY 63_|_1
     2021-09-05 18:59:13   2021-09-05_06-23-49__16_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.7_|_1
     2021-09-05 18:59:13   2021-09-05_06-23-49__17_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_06-23-49__18_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_06-36-28__19_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.7_|_1
     2021-09-05 18:59:13   2021-09-05_06-56-57__20_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_06-56-57__21_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_08-21-57__22_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.6_|_1
     2021-09-05 18:59:13   2021-09-05_08-21-57__23_EG_Bad_Heizung__1.HUMIDITY 62_|_1
     2021-09-05 18:59:13   2021-09-05_08-21-57__24_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_08-42-55__25_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.6_|_1
     2021-09-05 18:59:13   2021-09-05_08-42-55__26_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_08-42-55__27_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_10-09-01__28_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.6_|_1
     2021-09-05 18:59:13   2021-09-05_10-09-01__29_EG_Bad_Heizung__1.HUMIDITY 62_|_1
     2021-09-05 18:59:13   2021-09-05_10-09-01__30_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_10-28-18__31_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_11-55-37__32_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 20.6_|_1
     2021-09-05 18:59:13   2021-09-05_11-55-37__33_EG_Bad_Heizung__1.HUMIDITY 63_|_1
     2021-09-05 18:59:13   2021-09-05_11-55-37__34_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_12-15-15__35_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_12-15-15__36_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_15-28-07__37_EG_Bad_Heizung__1.HUMIDITY 63_|_1
     2021-09-05 18:59:13   2021-09-05_15-28-07__38_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_15-37-30__39_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_15-37-30__40_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_16-36-12__41_EG_Bad_Heizung__1.HUMIDITY 63_|_1
     2021-09-05 18:59:13   2021-09-05_16-36-12__42_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_17-23-38__43_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 21.0_|_1
     2021-09-05 18:59:13   2021-09-05_17-23-38__44_EG_Bad_Heizung__1.LEVEL 0_|_1
     2021-09-05 18:59:13   2021-09-05_17-23-38__45_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   2021-09-05_18-22-35__46_EG_Bad_Heizung__1.ACTUAL_TEMPERATURE 21.1_|_1
     2021-09-05 18:59:13   2021-09-05_18-22-35__47_EG_Bad_Heizung__1.HUMIDITY 64_|_1
     2021-09-05 18:59:13   2021-09-05_18-22-35__48_EG_Bad_Heizung__1.SET_POINT_TEMPERATURE 6.0_|_1
     2021-09-05 18:59:13   number_rows_to_delete 49
     2021-09-05 18:59:13   state           done
Attributes:
   DbLogExclude .*
   allowDeletion 1
   device     EG_Bad_Heizung
   room       System
   timestamp_begin current_day_begin
   timestamp_end current_day_end
   verbose    5


Wenn es dann aber ans löschen geht- mit delDoublets delete bekomme ich die Meldung "Process died prematurely". Das List sieht dann so aus:

Attributes:
   DbLogExclude .*
   allowDeletion 1
   device     EG_Bad_Heizung
   room       System
   timestamp_begin current_day_begin
   timestamp_end current_day_end
   verbose    5
   
   Internals:
   DATABASE   /opt/fhem/fhem.db
   DEF        DBLOG
   FUUID      5c55c030-f33f-fa12-431b-89187c8e58a0ddd9
   FVERSION   93_DbRep.pm:v8.42.8-s24770/2021-07-18
   LASTCMD    delDoublets delete
   MODEL      Client
   NAME       Daten
   NOTIFYDEV  global,Daten
   NR         35
   NTFY_ORDER 50-Daten
   ROLE       Client
   STATE      Process died prematurely
   TYPE       DbRep
   UTF8       0
   HELPER:
     DBLOGDEVICE DBLOG
     IDRETRIES  2
     MINTS      201%-04-02 03:15:16
     PACKAGE    main
     SQLHIST   
     VERSION    8.42.8
     CV:
       aggregation day
       aggsec     86400
       destr      2021-09-05
       dsstr      2021-09-05
       epoch_seconds_end 1630879199
       mestr      09
       msstr      09
       testr      23:59:59
       tsstr      00:00:00
       wdadd     
       yestr      2021
       ysstr      2021
     DBREPCOL:
       COLSET     1
       DEVICE     64
       EVENT      0
       READING    64
       TYPE       64
       UNIT       32
       VALUE      128
     RUNNING_PID:
   OLDREADINGS:
   READINGS:
     2021-09-05 19:09:59   state           Process died prematurely
Attributes:
   DbLogExclude .*
   allowDeletion 1
   device     EG_Bad_Heizung
   room       System
   timestamp_begin current_day_begin
   timestamp_end current_day_end
   verbose    5


und das Logfile sagt was von einem Syntax Fehler:

  2021.09.05 19:10:00 2: DbRep Daten - Database command aborted due to "Process died prematurely"
2021.09.05 19:10:00 1: sendEmail returned: Sep 05 19:10:00 raspi3 sendEmail[3555]: WARNING => The recipient xxxx was rejected by the mail server, error follows:Sep 05 19:10:00 raspi3 sendEmail[3555]: WARNING => Received: 550-Requested action not taken: mailbox unavailable, 550 Failure sending mail. Try again laterSep 05 19:10:00 raspi3 sendEmail[3555]: WARNING => The recipient xxxxx was rejected by the mail server, error follows:Sep 05 19:10:00 raspi3 sendEmail[3555]: WARNING => Received: 550-Requested action not taken: mailbox unavailable, 550 Failure sending mail. Try again laterSep 05 19:10:00 raspi3 sendEmail[3555]: ERROR => Exiting. No recipients were accepted for delivery by the mail server.
2021.09.05 19:09:59 1: DbRep Daten -> BlockingCall  pid: Process died prematurely
[Sun Sep  5 19:09:59 2021] fhem.pl: Use of uninitialized value in concatenation (.) or string at ./FHEM/93_DbRep.pm line 9402.
[Sun Sep  5 19:09:59 2021] fhem.pl: Use of uninitialized value in concatenation (.) or string at ./FHEM/93_DbRep.pm line 9402.
2021.09.05 19:09:59 5: DbRep Daten - BlockingCall finished PID "DEAD:3551"
[Sun Sep  5 19:09:59 2021] fhem.pl: DBD::SQLite::db prepare failed: near "limit": syntax error at ./FHEM/93_DbRep.pm line 5621.
</p>

and the time and date of the error.
For help, please send mail to this site's webmaster, giving this error message
<p>
</pre>
<pre>DBD::SQLite::db prepare failed: near &quot;limit&quot;: syntax error at ./FHEM/93_DbRep.pm line 5621.
<h1>Software error:</h1>
2021.09.05 19:09:58 4: DbRep Daten - WARP: EG_Bad_Heizung_ESC_1.ACTUAL_TEMPERATURE_ESC_2021-09-05_ESC_01:05:18_ESC_20.9_|_1, ntodel: 0, c: 1
2021.09.05 19:09:58 4: DbRep Daten - SQL execute: SELECT TIMESTAMP,DEVICE,READING,VALUE,count(*) FROM history where ( DEVICE = 'EG_Bad_Heizung' ) AND TIMESTAMP >= '2021-09-05 00:00:00' AND TIMESTAMP <= '2021-09-05 23:59:59' GROUP BY TIMESTAMP, DEVICE, READING, VALUE HAVING count(*) > 1 ORDER BY TIMESTAMP ASC;
excluded with wildcard:
excluded (0): 
included with wildcard: 
included (1): %
2021.09.05 19:09:58 5: DbRep Daten - Readings for operation -
excluded with wildcard:
excluded (0): 
included with wildcard: 
included (1): EG_Bad_Heizung
2021.09.05 19:09:58 5: DbRep Daten - Devices for operation -
excluded with wildcard:
excluded (0): 
included with wildcard: 
included (1): %
2021.09.05 19:09:58 5: DbRep Daten - Readings for operation -
excluded with wildcard:
excluded (0): 
included with wildcard: 
included (1): EG_Bad_Heizung
2021.09.05 19:09:58 5: DbRep Daten - Devices for operation -
2021-09-05#2021-09-05 00:00:00#2021-09-05 23:59:59
2021.09.05 19:09:58 5: DbRep Daten - Timestamp-Array:
2021.09.05 19:09:58 5: DbRep Daten - start BlockingCall with PID "3551"
2021.09.05 19:09:58 4: DbRep Daten - Aggregation: day
2021.09.05 19:09:58 5: DbRep Daten - runtime_string: 2021-09-05, runtime_string_first: 2021-09-05 00:00:00, runtime_string_next: 2021-09-05 23:59:59
2021.09.05 19:09:58 5: DbRep Daten - Daylight savings changed: 0 (on Mon Sep  6 00:00:00 2021)
2021.09.05 19:09:58 4: DbRep Daten - Timestamp end human readable: 2021-09-05 23:59:59
2021.09.05 19:09:58 5: DbRep Daten - Timestamp end epocheseconds: 1630879199
2021.09.05 19:09:58 4: DbRep Daten - Timestamp begin human readable: 2021-09-05 00:00:00
2021.09.05 19:09:58 5: DbRep Daten - Timestamp begin epocheseconds: 1630792800
2021.09.05 19:09:58 4: DbRep Daten - FullDay option: 0
2021.09.05 19:09:58 4: DbRep Daten - Command: delDoublets delete
2021.09.05 19:09:58 4: DbRep Daten - -------- New selection ---------


Hat jemand einen Tipp für mich, wo ich noch ansetzen kann?

Danke und schönen Abend noch.
Tom



DS_Starter

Hallo Tom,

ich habe versucht das Problem bei mir nachzustellen.
Allerdings läuft das Löschen bei mit auf SQLITE problemlos.

Aber ich habe in der SQLITE Referenz (https://www.sqlite.org/lang_delete.html) einen Hinweis darauf gefunden, dass die Verwendung der LIMIT-Clause die ich für die Funktion benötige von der Compilation von SQLITE abhängt.
Bei meiner Version auf Debian ist das offensichtlich der Fall.

Worauf läuft dein FHEM ?

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

tom2966

Hallo Heiko,

danke für den Tipp. Das könnte ne Spur sein. Mein FHEM läuft auf Raspberry 3 B unter raspbian Buster. Ich muss heute Abend noch mal checken welche SQLite Version ich nutze- die ist ganz bestimmt nicht die aktuellste. Ich melde mich am Abend noch mal.

Gruß
Tom

DS_Starter

Hallo Tom,

ich habe dir eine DbRep Testversion auf mein contrib gestellt.
Für SQLite kommt jetzt eine veränderte SQL Syntax zum Einsatz die m.M. nach auch für deine SQLite Version passen sollte.
Bei mir klappt es nach wie vor.

Zum Download in der FHEMWEB Kommandozeile inklusive der Ausführungszeichen angeben und danach FHEM restarten:


"wget -qO ./FHEM/93_DbRep.pm https://svn.fhem.de/fhem/trunk/fhem/contrib/DS_Starter/93_DbRep.pm"


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

tom2966

Hallo Heiko,

super- Danke! Ich muss erst mal noch richtigstellen- mein Raspi läuft mit Stretch. Und SQLITE habe ich die Version 3.16.2, ich meine mich am zu erinnern das es nur in größeren Abständen waf rü den Rapi gabe. Aber egal- die Testversion von Dir hat einwandfrei funktioniert! Danke!

VG
Thomas

DS_Starter

Prima ... und ich danke dir sehr !  :D

Die neue Version checke ich ein. Sie ist dann morgen früh im Update enthalten.

LG,
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