Project flakiness on macintosh

I have hesitated to ask about this issue because at first I it seemed hard to reproduce. It may also be platform specific, since it happens on my mac but not (apparently) on a Rpi. Recently, though, I have started shutting down my mac every night instead of just putting the machine to sleep (see below), and it has really started to make me crazy. So here goes.

If I shut down and restart my mac (macOS 10.11.6), having stopped NR first, when I restart NR it fails to find the current project and uses the default flows file instead:

Welcome to Node-RED

1 Feb 12:55:14 - [info] Node-RED version: v0.19.5
1 Feb 12:55:14 - [info] Node.js version: v8.11.2
1 Feb 12:55:14 - [info] Darwin 15.6.0 x64 LE
1 Feb 12:55:14 - [info] Loading palette nodes
1 Feb 12:55:15 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
1 Feb 12:55:16 - [info] Dashboard version 2.13.2 started at /ui
1 Feb 12:55:16 - [info] Settings file : /Users/mikebell/.node-red/settings.js
1 Feb 12:55:16 - [info] Context store : 'default' [module=memory]
1 Feb 12:55:16 - [info] User directory : /Users/mikebell/.node-red
1 Feb 12:55:16 - [warn] No active project : using default flows file
1 Feb 12:55:16 - [info] Flows file : /Users/mikebell/.node-red/flows_MIB-MBP.local.json
1 Feb 12:55:16 - [info] Server now running at http://127.0.0.1:1880/

The editor knows that projects are enabled, but the Projects/Open menu item is grey. The
.config.json file contains

"projects": {
"projects": {
"control": {
"credentialSecret": "secret"
},
"worldmap-demo": {
"credentialSecret": "secret"
},
"test": {
"credentialSecret": "secret"
},
"gate_examples": {
"credentialSecret": false
},
"flow_analysis": {
"credentialSecret": false
},
"ha_expt": {
"credentialSecret": false
},
"remote-gate": {
"credentialSecret": ""
},
"debug-status-question": {
"credentialSecret": false
}
},
"activeProject": "ha_expt"
}

So it is as if this file is not being read (assuming that is where NR should be looking). I can recover by stopping and restarting NR. The dialogs that follow include:

The flows on the server have been updated.
The server is running a more recent set of flows.
The changes include no conflicts and can be merged automatically.

Merging shows all nodes as "dirty" but the Deploy button is disabled. After refreshing the browser, everything is back to normal.

I should mention that I start NR from the command line, since I have never figured out how to run it as system service on the mac. I use systemd on the Rpi, so I suppose this could make a difference. Any thoughts?

When you start NR from the command exactly what do you enter?

node-red

Ok, then it will start up NR using the flow in youruserid/.node_red and the flow will be something like flows_Pauls-mini.local.json - the Pauls-mini comes from the computer name you can see in the System Preferences/Sharing/Computer name where spaces are replaced by the underscore.

You could go look in the .node_red folder to see what the last flow that was updated is. In the finder go to your user folder and then select in the Go menu Go to Folder... and enter .node-red.

This might give you an idea of what is happening.

@zenofmud you've missed the part where @drmibell explained he was using Projects.

@drmibell that is very odd. Your .config.json file includes the projects.activeProject setting which is the only thing it uses to know what project it ought to be running.

The fact it has logged [warn] No active project : using default flows file means it knows you have Projects enabled, but hasn't found the activeProject setting.

I'm at a loss to explain that.

The rest of the behaviour you describe stems from that; it hasn't found the active project so found and is running the default flows file. The editor reconnects to the runtime, finds the flows are different and offers to merge them. You probably don't want to do that. A reload of the editor will load the clean set of flows it is currently running.

So... thanks for reporting. I haven't seen this behaviour myself, nor can think what could cause that set of events given what you've shown us. A bit inconclusive.

I'm almost glad that I haven't missed anything obvious. If I find a cure, I'll post it.

OK, but how do I get back to running my Projects? I'll try not merging and restarting NR. Perhaps it will find them on the second try.

If the Projects -> Open option isn't available, can you do Projects -> New and then switch to the Open Project tab in the dialog?

You should also be able to get to the Open Project dialog with Cmd-Alt-O

Thanks for the suggestions.

For some (or possibly the same) reason, the Projects -> New dialog does not show Open Project, just Create Project and Clone Repository.

This works and gets me a clean start of the project I select.

Chasing this down has been slow, since it requires a reboot each time I want to try something different. The only progress is that I have started getting error messages that I had not seen before. (I'm not sure what I did to make this happen. :confused:)

Welcome to Node-RED

5 Feb 11:45:20 - [info] Node-RED version: v0.19.5
5 Feb 11:45:20 - [info] Node.js version: v8.11.2
5 Feb 11:45:20 - [info] Darwin 15.6.0 x64 LE
5 Feb 11:45:20 - [info] Loading palette nodes
5 Feb 11:45:21 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
5 Feb 11:45:22 - [info] Dashboard version 2.13.2 started at /ui
5 Feb 11:45:22 - [info] Settings file : /Users/mikebell/.node-red/settings.js
5 Feb 11:45:22 - [info] Context store : 'default' [module=memory]
5 Feb 11:45:22 - [info] User directory : /Users/mikebell/.node-red
5 Feb 11:45:22 - [warn] No active project : using default flows file
5 Feb 11:45:22 - [info] Flows file : /Users/mikebell/.node-red/flows_MIB-MBP.local.json
5 Feb 11:45:22 - [info] Creating new flow file
5 Feb 11:45:22 - [info] Starting flows
5 Feb 11:45:22 - [info] Started flows
5 Feb 11:45:22 - [info] Server now running at http://127.0.0.1:1880/
Error: Cannot operate on inactive project wanted:ha_expt current:undefined
at checkActiveProject (/usr/local/lib/node_modules/node-red/red/runtime/storage/localfilesystem/projects/index.js:224:15)
at Object.getStatus (/usr/local/lib/node_modules/node-red/red/runtime/storage/localfilesystem/projects/index.js:283:5)
at /usr/local/lib/node_modules/node-red/red/api/editor/projects/index.js:152:38
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
at /usr/local/lib/node_modules/node-red/red/api/auth/index.js:63:13
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
Error: Cannot operate on inactive project wanted:ha_expt current:undefined
at checkActiveProject (/usr/local/lib/node_modules/node-red/red/runtime/storage/localfilesystem/projects/index.js:224:15)
at Object.getProject (/usr/local/lib/node_modules/node-red/red/runtime/storage/localfilesystem/projects/index.js:206:5)
at /usr/local/lib/node_modules/node-red/red/api/editor/projects/index.js:124:38
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
at /usr/local/lib/node_modules/node-red/red/api/auth/index.js:63:13
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
Error: Cannot operate on inactive project wanted:ha_expt current:undefined
at checkActiveProject (/usr/local/lib/node_modules/node-red/red/runtime/storage/localfilesystem/projects/index.js:224:15)
at Object.getCommits (/usr/local/lib/node_modules/node-red/red/runtime/storage/localfilesystem/projects/index.js:254:5)
at /usr/local/lib/node_modules/node-red/red/api/editor/projects/index.js:308:38
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
at /usr/local/lib/node_modules/node-red/red/api/auth/index.js:63:13
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)

To me, this just confirms that the active project is not being found, but I'm sure it will mean more to you.