ItsEcholot / ContainerNursery

Puts Docker Containers to sleep and wakes them back up when they're needed
MIT License
94 stars 6 forks source link

ContainerNursery crashes on malformed Docker event JSON #28

Closed ItsEcholot closed 2 years ago

ItsEcholot commented 2 years ago

Reported by Alfy1080 on the Unraid Forum:

Hello. I configured ContainerNursery and it works like a charm. However it sometimes crashes by itself and i have no idea why. This is what i see in the log every time when it crashes:

undefined:1
{"read":"2021-11-28T15:03:04.317785879Z","preread":"2021-11-28T15:03:03.283758224Z","pids_stats":{"current":27},"blkio_stats":{"io_service_bytes_recursive":[{"major":8,"minor":112,"op":"Read","value":492716032},{"major":8,"minor":112,"op":"Write","value":32768},{"major":8,"minor":112,"op":"Sync","value":492748800},{"major":8,"minor":112,"op":"Async","value":0},{"major":8,"minor":112,"op":"Discard","value":0},{"major":8,"minor":112,"op":"Total","value":492748800},{"major":8,"minor":160,"op":"Read","value":495140864},{"major":8,"minor":160,"op":"Write","value":106496},{"major":8,"minor":160,"op":"Sync","value":495247360},{"major":8,"minor":160,"op":"Async","value":0},{"major":8,"minor":160,"op":"Discard","value":0},{"major":8,"minor":160,"op":"Total","value":495247360},{"major":7,"minor":2,"op":"Read","value":987856896},{"major":7,"minor":2,"op":"Write","value":139264},{"major":7,"minor":2,"op":"Sync","value":987996160},{"major":7,"minor":2,"op":"Async","value":0},{"major":7,"minor":2,"op":"Discard","value":0},{"major":7,"minor":2,"op":"Total","value":987996160}],"io_serviced_recursive":[{"major":8,"minor":112,"op":"Read","value":120292},{"major":8,"minor":112,"op":"Write","value":4},{"major":8,"minor":112,"op":"Sync","value":120296},{"major":8,"minor":112,"op":"Async","value":0},{"major":8,"minor":112,"op":"Discard","value":0},{"major":8,"minor":112,"op":"Total","value":120296},{"major":8,"minor":160,"op":"Read","value":120884},{"major":8,"minor":160,"op":"Write","value":7},{"major":8,"minor":160,"op":"Sync","value":120891},{"major":8,"minor":160,"op":"Async","value":0},{"major":8,"minor":160,"op":"Discard","value":0},{"major":8,"minor":160,"op":"Total","value":120891},{"major":7,"minor":2,"op":"Read","value":15399},{"major":7,"minor":2,"op":"Write","value":12},{"major":7,"minor":2,"op":"Sync","value":15411},{"major":7,"minor":2,"op":"Async","value":0},{"major":7,"minor":2,"op":"Discard","value":0},{"major":7,"minor":2,"op":"Total","value":15411}],"io_queue_recursive":[],"io_service_time_recursive":[],"io_wait_time_recursive":[],"io_merged_recursive":[],"io_time_recursive":[],"sectors_recursive":[]},"num_procs":0,"storage_stats":{},"cpu_stats":{"cpu_usage":{"total_usage":1580673183827,"percpu_usage":[136591228373,106160781099,127593972219,148154351579,144195817404,132300399864,122134487960,118729123484,135504818319,137865795981,134722498298,136719909247,0,0,0,0],"usage_in_kernelmode":310490000000,"usage_in_usermode":984030000000},"system_cpu_usage":1782568880000000,"online_cpus":12,"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"precpu_stats":{"cpu_usage":{"total_usage":1580668857736,"percpu_usage":[136588457807,106160781099,127593972219,148154254726,144195817404,132300258201,122134487960,118729123484,135504725654,137865795981,134722498298,136718684903,0,0,0,0],"usage_in_kernelmode":310490000000,"usage_in_usermode":984030000000},"system_cpu_usage":1782556530000000,"online_cpus":12,"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"memory_stats":{"usage":555679744,"max_usage":758505472,"stats":{"active_anon":0,"active_file":26578944,"cache":56770560,"dirty":0,"hierarchical_memory_limit":9223372036854771712,"hierarchical_memsw_limit":9223372036854771712,"inactive_anon":496332800,"inactive_file":22499328,"mapped_file":25681920,"pgfault":6842979,"pgmajfault":1155,"pgpgin":11106612,"pgpgout":11076689,"rss":487251968,"rss_huge":69206016,"total_active_anon":0,"total_active_file":26578944,"total_cache":56770560,"total_dirty":0,"total_inactive_anon":496332800,"total_inactive_file":22499328,"total_mapped_file":25681920,"total_pgfault":6842979,"total_pgmajfault":1155,"total_pgpgin":11106612,"total_pgpgout":11076689,"total_rss":487251968,"total_rss_huge":69206016,"total_unevictable":0,"total_writeback":0,"unevictable":0,"writeback":0},"limit":12552155136},"name":"/emby","id":"e6fd7da6a145a05ac3e6d5af16b85f9ebfa38c362072e9970646c16a5d53053e","networks":{"eth0":{"rx_bytes":667201285,"rx_packets":580695,"rx_errors":0,"rx_dropped":0,"tx_bytes":188815145,"tx_packets":290544,"tx_erro

SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (/usr/src/app/build/DockerManager.js:112:62)
at IncomingMessage.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at IncomingMessage.Readable.push (node:internal/streams/readable:228:10)
at HTTPParser.parserOnBody (node:_http_common:141:24)
at Socket.socketOnData (node:_http_client:487:22)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)