# Machine times between reboots/lockups reducing

**URL:** <https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433>\
**Category:** General\
**Created:** [29 May 2021 00:49 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433 "2021-05-29T00:49:17Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 June 2021 23:09 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/21 "2021-06-01T23:09:36Z")

</div>

Yes, that is (now) alas the point of suspicion. ☹  
They (RasPies) don't have any over voltage detection - like with their under voltage one?

That would go a long way to _proving_ that is the problem.

I know it isn't under voltage - or am 99% sure - as I have code that if it happens it logs the event.

I haven't proved it. But I know a few times in early days I was doing things and I got a notification of under voltage and so the power supply was replaced with a bigger one.

That was more an _oops_ moment as they are all pretty similar in looks and I got an early one for a newer RasPi which needed more amps than that supply could give.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 June 2021 23:39 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/22 "2021-06-01T23:39:04Z")

</div>

Frankly, over-voltage is unlikely to be a problem as long as you didn't leave lots of extra volts connected for hours.

> [@Trying\_to\_learn](#):
>
> I know it isn't under voltage - or am 99% sure - as I have code that if it happens it logs the event.

I wouldn't trust that. You need to measure it. Don't forget that a USB cable can loose a lot. A USB tester can be put on the Pi end of the cable so that you know exactly what the Pi is getting.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 June 2021 03:21 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/23 "2021-06-02T03:21:05Z")

</div>

Sorry. I was only mentioning what I had seen.

I shall have to see if I can get a USB voltage tester then.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 06:38 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/24 "2021-06-02T06:38:14Z")

</div>

If you have another pi on the system that runs for months without a reset then try swapping the PSUs and cables between the two devices and see what happens.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 June 2021 06:40 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/25 "2021-06-02T06:40:42Z")

</div>

(If only it was that easy)

For now there are three and none of them are playing the game.

Alas each one with its own quirks which further complicates things for me.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 07:12 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/26 "2021-06-02T07:12:41Z")

</div>

Are you using official pi power supply units bought from a reputable source?

Have you got any devices connected directly into the pi?

Are any of the others having unexplained reboots that when you look in the log don't show a normal shutdown?

Do you see reboots on more than one device at the same time?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 June 2021 07:14 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/27 "2021-06-02T07:14:37Z")

</div>

Alas no.

I have them. Just to use them space didn't permit.

One machine has suffered SD card failure twice in a short time.  
I am now using a proper power supply to see how long it lives before dieing (spelling?) again.

I bought a good brand power board with USB ports witch can supply enough amps.  
But that is to be tested soon.

I got a USB tester, but I have to build it first.  
☹  
But that isn't beyond me.  
I just need to allocate the time to do it.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 07:15 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/28 "2021-06-02T07:15:53Z")

</div>

Is that all in answer to the first question? If so then what about the other three?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 June 2021 07:17 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/29 "2021-06-02T07:17:09Z")

</div>

That is one of the three.

the other two are still not lasting too long between reboots.  
But as it is only a week ago, I can't really say anything on that side of things.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 07:42 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/30 "2021-06-02T07:42:55Z")

</div>

Let me ask the original questions again, with numbers to make it easy

1. Are you using official pi power supply units bought from a reputable source?  
I think you have answered that one.

2. Have you got any devices connected directly into the pi?

3. Are any of the other pis having unexplained reboots that when you look in the log don't show a normal shutdown?

4. Do you see reboots on more than one device at the same time?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 June 2021 07:54 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/31 "2021-06-02T07:54:47Z")

</div>

1 - now on one of them, yes. The other two: no. But they have been like that since nearly day 0.

2 - Two of them have USB sticks plugged into them for backups. 1 has a WiFi dongle plugged into it, but it is not really doing anything because of WAP and KERNEL conflicts. That one also has a RTC installed in/on it.

3 - All 3 seem to have 1 week life between reboots. Looking at the logs hasn't happened yet.  
Other than the one I showed you and it was an uncommanded reboot.  
One of these also has a (nearly) NEO pixel led strip plugged onto it's GPIO pins.  
It isn't a NEOPIXEL one, but the other one. (Basically the same though: addressable RGB)

Reboot histories as best I can show:

Machine 1:

```auto
pi@TimePi:~/.node-red/public/logs/reboot/2021-05 $ lf
Rebooted at 2021-05-04 140059.db Rebooted at 2021-05-15 041242.db Rebooted at 2021-05-26 070713.db
Rebooted at 2021-05-12 073744.db Rebooted at 2021-05-15 072132.db
pi@TimePi:~/.node-red/public/logs/reboot/2021-05 $ cd ..
pi@TimePi:~/.node-red/public/logs/reboot $ ls
2019 2020 2021-01 2021-02 2021-03 2021-04 2021-05 last_alive.db Rebooted at 2021-06-02 081319.db
pi@TimePi:~/.node-red/public/logs/reboot $ 

```

Machine 2:

```auto
pi@TelePi:/media/pi/9020-9C27/logs/reboot $ ls
2021-05 arc last_alive.db
pi@TelePi:/media/pi/9020-9C27/logs/reboot $ ls 2021-05
Rebooted at 2021-05-24 212055.db Rebooted at 2021-05-28 133010.db
pi@TelePi:/media/pi/9020-9C27/logs/reboot $ 

```

Machine 3:

```auto
pi@BedPi:/media/pi/06BB-C87D/logs/reboot $ ls
2021-05 last_alive.db OLD
pi@BedPi:/media/pi/06BB-C87D/logs/reboot $ ls 2021-05/
'Rebooted at 2021-05-25 134106.db' 'Rebooted at 2021-05-25 150252.db' 'Rebooted at 2021-05-25 173641.db'
'Rebooted at 2021-05-25 134220.db' 'Rebooted at 2021-05-25 154729.db' 'Rebooted at 2021-05-29 111834.db'
pi@BedPi:/media/pi/06BB-C87D/logs/reboot $ 

```

Machine 3 has only just got a new SD card and is now using an official power supply to see if that is/was a problem.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 08:18 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/32 "2021-06-02T08:18:18Z")

</div>

Is that a `No` then to question 4?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [2 June 2021 08:23 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/33 "2021-06-02T08:23:26Z")

</div>

@Trying_to_learn you could try [https://flows.nodered.org/node/node-red-contrib-vcgencmd](https://flows.nodered.org/node/node-red-contrib-vcgencmd)  
Your pi can tell you if it's currently, or even previously had a low voltage supply.  
Check the node readme.

I used this node after problems, and it pointed me to replacing the power supply.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 10:04 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/34 "2021-06-02T10:04:39Z")

</div>

Good idea. Or just use `vcgencmd` from a terminal if just a check is needed.

---

<div class="post-metadata">

**Author:** ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)\
**Post date:** [2 June 2021 12:15 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/35 "2021-06-02T12:15:30Z")

</div>

Hi @Trying_to_learn

Just sticking my uneducated nose in here - I had a slow "memory leak" that I eventually tracked down to ?tcp sockets? being left open .... (sorry, not the best at remembering the right terms)

I ultimately found the problem(with a hell of a lot of help from pretty much everybody who has answered you here) ... One of the "tools" I used was this:

```auto
[
    {
        "id": "f16c8c4d.9d7c5",
        "type": "inject",
        "z": "3055fb7f.f62864",
        "name": "Tickler 10sec",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "10",
        "crontab": "",
        "once": true,
        "onceDelay": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 310,
        "wires": [
            [
                "c602dc4f.4d9978",
                "cf97546.7fa3028",
                "d33f08eb.80118",
                "d14e39e5.54206",
                "98bb25d9.a33d38"
            ]
        ]
    },
    {
        "id": "d14e39e5.54206",
        "type": "exec",
        "z": "3055fb7f.f62864",
        "command": "cat /proc/net/sockstat | grep sockets | awk '{print ($3)*1}'",
        "addpay": false,
        "append": "",
        "useSpawn": "",
        "timer": "",
        "name": "TCP Sockets Used",
        "x": 320,
        "y": 250,
        "wires": [
            [
                "11fab008.76c098"
            ],
            [],
            []
        ]
    },
    {
        "id": "11fab008.76c098",
        "type": "string",
        "z": "3055fb7f.f62864",
        "name": "",
        "methods": [
            {
                "name": "toInteger",
                "params": []
            }
        ],
        "prop": "payload",
        "propout": "payload",
        "object": "msg",
        "objectout": "msg",
        "x": 480,
        "y": 250,
        "wires": [
            [
                "e16f3731.ee6b8"
            ]
        ]
    },
    {
        "id": "e16f3731.ee6b8",
        "type": "smooth",
        "z": "3055fb7f.f62864",
        "name": "",
        "property": "payload",
        "action": "mean",
        "count": "10",
        "round": "0",
        "mult": "single",
        "reduce": false,
        "x": 600,
        "y": 280,
        "wires": [
            [
                "a309e776.043b88",
                "6100f9b9.75055",
                "c140aa12.b358b"
            ]
        ]
    },
    {
        "id": "c140aa12.b358b",
        "type": "debug",
        "z": "3055fb7f.f62864",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 310,
        "wires": []
    }
]

```

The output of this can be filed away in influx etc and you can see if the number of sockets used increases over time, ultimately leading to a lockup/reboot situation....

Forgive me if I am sending you on a wild goose chase, not my intention...

Regds  
Ed

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 14:02 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/36 "2021-06-02T14:02:24Z")

</div>

The issue here doesn't appear to be a memory leak as the symptom is a sudden reboot without a normal shutdown. A memory leak would lead to an out of memory notification in the log and a node-red restart. Not a reboot.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2021 14:05 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/37 "2021-06-02T14:05:46Z")

</div>

Also while not unexpected if a sudden outage occurred when it starts doing this - it's generally not a good sign...

> [@Trying\_to\_learn](#):
>
> ```auto
> May 28 13:17:14 TelePi kernel: [3.410834] EXT4-fs (mmcblk0p2): orphan cleanup on readonly fs
> May 28 13:17:14 TelePi kernel: [3.447763] EXT4-fs (mmcblk0p2): 7 orphan inodes deleted
> May 28 13:17:14 TelePi kernel: [3.459120] EXT4-fs (mmcblk0p2): recovery complete
> 
> ```

... as you can never be sure what exactly it deleted - maybe something vital... maybe not... maybe a swiss cheese operating system.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [2 June 2021 15:23 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/38 "2021-06-02T15:23:56Z")

</div>

I'm also wondering if you have a poor mains supply given that you have multiple Pi's with issues.

It is possible that a spiky mains supply could cause such issues unless your USB PSU's are attached via a decent filtered power block. Not as common in many countries now but there are certainly areas that suffer from poor, spiky supplies. You might even be causing it by having bad wiring or a faulty electrical device around your property somewhere. Do you have other electrical problems?

I think the orphan cleanup is indicative of your SD-Card issues - you need to make sure that you are using cards that support wear levelling and that the card is large enough to allow it to work well. I use 32GB Samsung EVO or EVO-Pro cards and never have had a single issue since I started using them some years ago.

If you have a Pi that you can free up. Get a good new card, put a new, clean implementation of Rasbian and run it for a couple of weeks to make sure it is stable without any other config.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [3 June 2021 00:09 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/39 "2021-06-03T00:09:46Z")

</div>

Yes Paul.

That is what I use.

Glad I am not the only one - or: It is good that others are also doing this.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [3 June 2021 00:13 UTC](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433/40 "2021-06-03T00:13:40Z")

</div>

Ed,

Thanks very much.

Though others may scoff, I appreciate help.

I can't say if it is a memory leak or what.

But I think it is good/better to check all things.

I've imported it onto THIS machine - just for now to get a feel for what it does.

I'll stick it onto the other (three) machines soon and let it run it's course.

I may change it to every minute though.

Oh and it is good to hear it did help you to fix your problem.  
That's always a good thing.

[Previous page](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433.md?page=1)

[Next page](https://discourse.nodered.org/t/machine-times-between-reboots-lockups-reducing/46433.md?page=3)
