[vz-dev] Segmentation Fault - vzlogger - Landis&Gyr D0

Michael Wulz michael.wulz at gmail.com
Tue Sep 2 11:04:15 CEST 2014


Hallo nochmal,

und das die Variante mit Parser auskommentiert:

[Sep 02 09:01:07][d0]   DEBUG OBIS_CODE byte 0 hex= 30
[Sep 02 09:01:07][d0]   DEBUG OBIS_CODE byte . hex= 2E
[Sep 02 09:01:07][d0]   DEBUG OBIS_CODE byte 2 hex= 32
[Sep 02 09:01:07][d0]   DEBUG OBIS_CODE byte . hex= 2E
[Sep 02 09:01:07][d0]   DEBUG OBIS_CODE byte 2 hex= 32
[Sep 02 09:01:08][d0]   DEBUG OBIS_CODE byte ( hex= 28
[Sep 02 09:01:08][d0]   Parsed reading (OBIS code=0.2.2, value=999, unit=)
[Sep 02 09:01:08][d0]   DEBUG OBIS_CODE byte
 hex= A
[Sep 02 09:01:08][d0]   DEBUG OBIS_CODE byte C hex= 43
[Sep 02 09:01:08][d0]   DEBUG OBIS_CODE byte . hex= 2E
[Sep 02 09:01:08][d0]   DEBUG OBIS_CODE byte 2 hex= 32
[Sep 02 09:01:08][d0]   DEBUG OBIS_CODE byte . hex= 2E
[Sep 02 09:01:08][d0]   DEBUG OBIS_CODE byte 1 hex= 31
[Sep 02 09:01:08][d0]   DEBUG OBIS_CODE byte ( hex= 28
[Sep 02 09:01:09][d0]   Parsed reading (OBIS code=C.2.1, value=00-01-01
00:00, unit=)
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte
 hex= A
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte C hex= 43
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte . hex= 2E
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte 9 hex= 39
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte 0 hex= 30
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte . hex= 2E
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte 1 hex= 31
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte ( hex= 28
[Sep 02 09:01:09][d0]   Parsed reading (OBIS code=C.90.1, value=AAAAAAA,
unit=)
[Sep 02 09:01:09][d0]   DEBUG OBIS_CODE byte
 hex= A
[Sep 02 09:01:09][d0]   Read package with 30 tuples (vendor=LGZ,
baudrate=5, identification=\2ZMD3102400.B14)
[Sep 02 09:01:09][mtr0] Got 30 new readings from meter:
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=4346.80 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=4155.20 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=3945.30 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=3750.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=3524.50 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=3278.30 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=3011.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=2764.30 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=2485.10 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=2201.90 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=1974.80 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=1729.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=1482.50 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=1259.80 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=0.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=0.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=0.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=0.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=0.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=0.00 ts=0.000
[Sep 02 09:01:09][mtr0] Reading:
id=0-0:0.0.0*0/ObisItentifier:0-0:0.0.0*0 value=0.00 ts=0.000


also scheint der Parser irgendwo bei den letzten Werten ein Problem zu
bekommen.

Habe schonmal folgendes probiert, hat aber auch nix gebracht:
 if
((obis_code[0]=='1')||(obis_code[0]=='2')||(obis_code[0]=='C')||(obis_code[0]=='!'))
{

gruss
Michael

Am 01.09.14 23:01, schrieb Reinhard Wilzeck:
> Hallo Michael,
> tatsächlich hatte ich in dem Bereich Probleme mit dem Parser.
> (Daher auch die ausführlichen log ausgaben)
> Da waren es aber der STX (hex 02) u.ä. der aber vorher abgefangen wird.
> Auch wird der Parser nur für codes gefragt die mit 1,2 oder C beginnen.
> 
> 
> 1. In diesem Fall verwirrt mich, dass der Parser noch gearbeitet hat und
> es erst beim nächsten lesen  der Fehler kommt  (vielleicht aber auch
> Zufall ,das die letzte log zeile nicht mehr ausgegeben wird).
> "
> 
> [Sep 01 12:36:16][d0]   Parsed reading (OBIS code=2.8.1*02,
> value=000000.0, unit=)
> [Sep 01 12:36:17][d0]   DEBUG OBIS_CODE byte
>  hex= A
> Segmentation fault
> 
> "
> In dem branch vzlogger-master scheint mir aber noch eine Schwäche zu sein.
> "
>             case END_LINE:
>                 if (byte == '\r' || byte == '\n') {
>                     /* free slots available and sain content? */
> *                    if ((number_of_tuples < max_readings) &&
> (strlen(obis_code) > 0) && **
> *                           *(strlen(value) > 0)*) {
>                         print(log_debug, "Parsed reading (OBIS code=%s,
> value=%s, unit=%s)", name().c_str(), obis_code, value, unit);
>                         rds[number_of_tuples].value(strtod(value, NULL));
>                     *    if
> ((obis_code[0]=='1')||(obis_code[0]=='2')||(obis_code[0]=='C')) {*
>                             /*print(log_debug, "DEBUG END_LINE Obis code
> = %s value %s ",name().c_str(), obis_code, value);*/
>                             Obis obis(obis_code);
>                             ReadingIdentifier *rid(new
> ObisIdentifier(obis));
>                             rds[number_of_tuples].identifier(rid);
>                             rds[number_of_tuples].time();
>                             byte_iterator = 0;
>                             number_of_tuples++;
>                         }
>                     }
>                     context = OBIS_CODE;
>                 }
>                 break;
> "
> Das heißt: egal wie die beiden inneren IF ausgehen: der Context wird auf
> OBIS_CODE gesetzt. Die folge ist, das wahrscheinlich der byte_iterator
> nicht auf 0 geschrieben wird. Also haben wir dort eine Überschreitung
> der Array grenzen, wenn z.B.  *number_of_tuples = max_readings* erreicht
> wird.
> Korrektur Vorschlag: 
> ...
>                     }
>                     byte_iterator = 0;
>                     context = OBIS_CODE;
>                 }
> 
> 
> 2) Zum testen mal den parser auskommentieren. Damit kannst Du
> ausschliessen, dass es der Parser ist. 
>   /*                         Obis obis(obis_code);
>                             ReadingIdentifier *rid(new
> ObisIdentifier(obis));
>                             rds[number_of_tuples].identifier(rid);
>                             rds[number_of_tuples].time();
>  */
> 
>  Gruß
>     Reinhard
> Am 01.09.2014 14:40, schrieb Michael Wulz:
>> Hallo Leute,
>>
>> mein neuer Vzlogger:
>>
>> root at raspberrypi:~# vzlogger --version
>> 0.3.6
>>
>> macht einen Segmentation Fault beim parsen der OID's.
>>
>> Meine Config:
>> {
>> "retry" : 30,                      /* how long to sleep between failed
>> requests, in seconds */
>> "daemon": false,                    /* run periodically */
>> "foreground" : true,              /* run in background */
>> "verbosity" : 9999,                   /* between 0 and 9999, je höher
>> desto mehr Infos */
>> "log" : "/var/log/vzlogger.log",   /* path to logfile, optional */
>>
>> "local" : {
>>         "enabled" : false,      /* local HTTPd for serving live
>> readings, 'false' für Daten an die middleware !!! */
>>         "port" : 80,            /* the TCP port for the local HTTPd */
>>         "index" : true,         /* should we provide a index listing of
>> available channels if no UUID was requested? */
>>         "timeout" : 30,         /* timeout for long polling comet
>> requests, 0 disables comet, in seconds */
>>         "buffer" : 600          /* how long to buffer readings for the
>> local interface, in seconds */
>>           },
>>
>> "meters" : [{                           /* Beispiel-Meter */
>>         "enabled" : true,               /* disabled meters will be
>> ignored (default) */
>>         "protocol" : "d0",              /* see 'vzlogger -h' for list of
>> available protocols */
>>         "device" : "/dev/ttyUSB0",
>>         "parity" : "7E1",               /* oder 8N1  */
>>         "baudrate" : 300,              /* oder 300  */
>>         "pullseq" : "2f3f210d0a",
>>         "interval" : 500,
>>           "interval": 6,                                   /* Wartezeit
>> in Sekunden bis neue Werte in die middleware übertragen werden */
>>            "channel": {                                   /*
>> Beispiel-channel */
>>                                  "uuid" :
>> "a02ea060-1e18-11e4-a178-5be9227ad291",
>>                                  "middleware" :
>> "http://127.0.0.1/middleware.php",
>>                                  "identifier" : "1-0:1.8.1" /* alias for
>> '1-0:1.8.1', see 'vzlogger -h' for list of available aliases */
>>                               }
>>                    }]
>> }
>>
>> der Output vom vzlogger:
>> [Sep 01 12:35:41][mtr0] Creating new meter with protocol d0.
>> [Sep 01 12:35:41][d0]   pullseq len:5 found
>> [Sep 01 12:35:41][mtr0] Meter configured. enabled
>> [Sep 01 12:35:41]       New meter initialized (protocol=d0)
>> [Sep 01 12:35:41]       Configure channel.
>> [Sep 01 12:35:41][chn0] New channel initialized (uuid=...7ad291
>> protocol=volkszaehler id=1-0:1.8.1)
>> [Sep 01 12:35:41]       Have 1 meters.
>> [Sep 01 12:35:41][main] foreground=1, daemon=0, local=0
>> [Sep 01 12:35:41]       NOT Daemonize process...
>> [Sep 01 12:35:41]       Opened logfile /var/log/vzlogger.log
>> [Sep 01 12:35:41][]     ===> Start meters.
>> [Sep 01 12:35:41][mtr0] Meter connection established
>> [Sep 01 12:35:41][mtr0] Meter thread started
>> [Sep 01 12:35:41][mtr0] meter is opened. Start channels.
>> [Sep 01 12:35:41][chn0] Logging thread started
>> [Sep 01 12:35:41][]     Startup done.
>> [Sep 01 12:35:41][chn0] Start logging thread for volkszaehler-api.
>> Running as daemon: no
>> [Sep 01 12:35:41][chn0] Using default api:
>> [Sep 01 12:35:41][mtr0] Number of readers: 32
>> [Sep 01 12:35:41][mtr0] Config.daemon: 0
>> [Sep 01 12:35:41][mtr0] Config.local: 0
>> [Sep 01 12:35:41][d0]   sending pullsequenz send (len:5 is:5).
>> [Sep 01 12:35:42][d0]   Pull answer (vendor=LGZ, baudrate=5,
>> identification=\2ZMD3102400.B14)
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte ^B hex= 2
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte F hex= 46
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte F hex= 46
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte ( hex= 28
>> [Sep 01 12:35:44][d0]   Parsed reading (OBIS code=F.F, value=02000000,
>> unit=)
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte
>>  hex= A
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte 0 hex= 30
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte 0 hex= 30
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte 0 hex= 30
>> [Sep 01 12:35:44][d0]   DEBUG OBIS_CODE byte ( hex= 28
>> [Sep 01 12:35:45][d0]   Parsed reading (OBIS code=0.0.0, value=11111111,
>> unit=)
>> [Sep 01 12:35:45][d0]   DEBUG OBIS_CODE byte
>>  hex= A
>>
>> [....]
>>
>> [Sep 01 12:36:14][d0]   DEBUG OBIS_CODE byte 2 hex= 32
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 8 hex= 38
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 1 hex= 31
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte * hex= 2A
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 1 hex= 31
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 0 hex= 30
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte ( hex= 28
>> [Sep 01 12:36:15][d0]   Parsed reading (OBIS code=2.8.1*10,
>> value=000000.0, unit=)
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte
>>  hex= A
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 2 hex= 32
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 8 hex= 38
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 1 hex= 31
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte * hex= 2A
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 0 hex= 30
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte 9 hex= 39
>> [Sep 01 12:36:15][d0]   DEBUG OBIS_CODE byte ( hex= 28
>> [Sep 01 12:36:16][d0]   Parsed reading (OBIS code=2.8.1*09,
>> value=000000.0, unit=)
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte
>>  hex= A
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte 2 hex= 32
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte 8 hex= 38
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte . hex= 2E
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte 1 hex= 31
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte * hex= 2A
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte 0 hex= 30
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte 2 hex= 32
>> [Sep 01 12:36:16][d0]   DEBUG OBIS_CODE byte ( hex= 28
>> [Sep 01 12:36:16][d0]   Parsed reading (OBIS code=2.8.1*02,
>> value=000000.0, unit=)
>> [Sep 01 12:36:17][d0]   DEBUG OBIS_CODE byte
>>  hex= A
>> Segmentation fault
>>
>> Es scheint der Zähler nach dem Obis CODE: 2.8.1*02 irgendein Zeichen zu
>> senden, dass den Parser abstürzen lässt.
>>
>> Hat jemand von euch das Problem auch schonmal gehabt?
>>
>> danke
>> Michael
>>
> 



More information about the volkszaehler-dev mailing list