Z-Wave-Me / z-way-issues

This repo is only to host issues for Z-Way.
6 stars 1 forks source link

Z-way crash with std::bad_alloc #125

Closed davidc closed 3 years ago

davidc commented 7 years ago

Server cannot stay up more than a few hours at a time. Having ruled out #101 as a red herring, I have now seen it crash several times with std::bad_alloc

gdb:

(gdb) r
Starting program: /opt/z-way-server/z-way-server
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Cannot access memory at address 0x0

Program received signal SIGILL, Illegal instruction.
0x7665cde8 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb)
(gdb) c
Continuing.
Z-Way version v2.3.4 from 2017-04-18 23:15:30 +0300 (build 21ca454ab9d8f31a29d9fa89a45ae29e6c7b1726)
Looking for modules in ./modules
Module modws.so loaded
Module modinstaller.so loaded
Module modenocean.so loaded
Module modnotification2ext.so loaded
Module moddhs.so loaded
Module modhttp.so loaded
Module modsockets.so loaded
Module modskininstaller.so loaded
Module modiconinstaller.so loaded
Module modzbw.so loaded
Module modcrypto.so loaded
Module modzwave.so loaded
Module modhomekit.so loaded
Using default configuration file config.xml
Error: 'debug-port' number is out of range. Skipping it.
[New Thread 0x756b7450 (LWP 23440)]
[New Thread 0x75766450 (LWP 23441)]
[New Thread 0x74eb7450 (LWP 23442)]
[New Thread 0x74ea7450 (LWP 23443)]
[New Thread 0x74e97450 (LWP 23444)]
[New Thread 0x74e87450 (LWP 23445)]
[New Thread 0x684ff450 (LWP 23460)]
[New Thread 0x60aff450 (LWP 23878)]
[New Thread 0x5e1ff450 (LWP 23879)]
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x74e87450 (LWP 23445)]
0x76380f70 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x76380f70 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x76382324 in __GI_abort () at abort.c:89
#2  0x76588b5c in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#3  0x765869a0 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) info thread
  Id   Target Id         Frame
  10   Thread 0x5e1ff450 (LWP 23879) "zway/timers" 0x763f2360 in nanosleep ()
    at ../sysdeps/unix/syscall-template.S:81
  9    Thread 0x60aff450 (LWP 23878) "zway/core" 0x7641d964 in select ()
    at ../sysdeps/unix/syscall-template.S:81
  8    Thread 0x684ff450 (LWP 23460) "zway/webserver" 0x7641d964 in select ()
    at ../sysdeps/unix/syscall-template.S:81
* 7    Thread 0x74e87450 (LWP 23445) "zway/core" 0x76380f70 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
  6    Thread 0x74e97450 (LWP 23444) "v8:SweeperThrea" 0x76975a40 in do_futex_wait (
    isem=isem@entry=0x6476c) at ../nptl/sysdeps/unix/sysv/linux/sem_wait.c:48
  5    Thread 0x74ea7450 (LWP 23443) "v8:SweeperThrea" 0x76975a40 in do_futex_wait (
    isem=isem@entry=0x64664) at ../nptl/sysdeps/unix/sysv/linux/sem_wait.c:48
  4    Thread 0x74eb7450 (LWP 23442) "v8:SweeperThrea" 0x76975a40 in do_futex_wait (
    isem=isem@entry=0x6455c) at ../nptl/sysdeps/unix/sysv/linux/sem_wait.c:48
  3    Thread 0x75766450 (LWP 23441) "v8:SweeperThrea" 0x76975a40 in do_futex_wait (
    isem=isem@entry=0x64454) at ../nptl/sysdeps/unix/sysv/linux/sem_wait.c:48
  2    Thread 0x756b7450 (LWP 23440) "OptimizingCompi" 0x76975a40 in do_futex_wait (
    isem=isem@entry=0x6430c) at ../nptl/sysdeps/unix/sysv/linux/sem_wait.c:48
  1    Thread 0x76ff4000 (LWP 23439) "z-way-server" 0x763f2360 in nanosleep ()
    at ../sysdeps/unix/syscall-template.S:81
(gdb)

Last lines of log are not very interesting

[2017-04-23 03:04:45.921] [D] [zway] RECEIVED: ( 01 0C 00 04 00 13 06 31 05 04 22 00 00 F0 )
[2017-04-23 03:04:45.921] [D] [zway] SENT ACK
[2017-04-23 03:04:45.922] [D] [zway] SETDATA devices.19.data.lastReceived = 0 (0x00000000)
[2017-04-23 03:04:45.922] [D] [zway] SETDATA devices.19.instances.0.commandClasses.49.data.4.deviceScale = 0 (0x00000000)
[2017-04-23 03:04:45.922] [D] [zway] SETDATA devices.19.instances.0.commandClasses.49.data.4.scale = 0 (0x00000000)
[2017-04-23 03:04:45.923] [D] [zway] SETDATA devices.19.instances.0.commandClasses.49.data.4.scaleString = "W"
[2017-04-23 03:04:45.923] [D] [zway] SETDATA devices.19.instances.0.commandClasses.49.data.4.val = 0.000000
[2017-04-23 03:04:45.923] [D] [zway] SETDATA devices.19.instances.0.commandClasses.49.data.4 = Empty
root@ha:/opt/z-way-server# date

Raspberry pi with Razberry.

Z-Way version v2.3.4 from 2017-04-18 23:15:30 +0300 (build 21ca454ab9d8f31a29d9fa89a45ae29e6c7b1726)

Anything else needed, please let me know

PoltoS commented 7 years ago

Looks like you are out of memory.

Please check sizes of files in automation/storage/

davidc commented 7 years ago
total 132692
drwxr-xr-x  2 root root      4096 Apr 23 03:04 .
drwxrwxr-x 11 pi   pi        4096 Apr 20 09:53 ..
-rw-r--r--  1 root root         3 Apr 20 09:53 8084AccessTimeout-6b497208061ec7faae003cdd7f9a035e.json
-rw-r--r--  1 root root      9394 Apr 20 09:59 admin1492675146013gif-e8d169d2d0614bcc34043d7dd4748f8a.json
-rw-r--r--  1 root root     24041 Apr 23 03:04 configjson-06b2d3b23dce96e1619d2b53d6c947ec.json
-rw-r--r--  1 root root        15 Apr 20 09:53 expertconfigjson-0ef43e77bc4a34ec19a6c355a525b65c.json
-rw-r--r--  1 root root     98035 Apr 23 00:00 history-3cd15f8f2940aff879df34df4e5c2cd1.json
-rw-r--r--  1 root root    397005 Apr 22 23:58 incomingPacketjson-5fa134bd40ea2f6f328252a67a68d93d.json
-rw-r--r--  1 root root         0 Apr 20 09:53 .keep
-rw-r--r--  1 root root        13 Apr 20 09:53 moduleTokensjson-e29993de748adf5cf0e062ce571f1bc1.json
-rw-r--r--  1 root root 135114868 Apr 23 03:04 notifications-f37bd2f66651e7d46f6d38440f2bc5dd.json
-rw-r--r--  1 root root    176925 Apr 22 23:59 originPacketsjson-a9224461330689488046261dbbc78a6d.json
-rw-r--r--  1 root root     19120 Apr 22 23:28 outgoingPacketjson-5ac52a30a37d9ec108b8b540a6ee42cf.json
-rw-r--r--  1 root root       191 Apr 23 03:04 storageContent-0c40aa7c27d2121efdfa27fff03c9548.json
root@ha:/opt/z-way-server#
PoltoS commented 7 years ago

Please replace notifications with the content of [] (empty square braces)

davidc commented 7 years ago

Thanks, it has not crashed again yet. However I noticed that the notifications.json file is up to almost a megabyte again already, most status reports of my kettle's power usage. How do we stop this growing infinitely?

PoltoS commented 7 years ago

We will fix that.

@zwave-mke This is the reason for most crashes we observe currently. Too big notifications.json!

PoltoS commented 3 years ago

Fixed a long time ago