Nested subflows with permanent "localfilesystem" context storage

Hi,

i run into some trouble with permanent value storage in nested subflows. I don’t know if this is generally possible, so I want to ask before open an issue.
I want to save some state variables in flow or node context level for different nested subflow levels. The subflows are not the same. What I observe is that only the first level is saved to “localfilesystem”. The other levels are undefined after a restart. I checked the same for function nodes ans context storage.
I created a simple testbench:

A flow with two nested subflows (level1 and level2). The testdata is written into is subflow flow context from the top-flow. The data is printed to debug window a short time after restart of the flow.

The debug window below shows:

  • Line 1-2: uninizialized two subflow context storages
  • Line 3: send data to storage
  • Line 4-5: read context storage after restart flow

Is this behavior normal? I didn’t found any info in relation to this specific topic.

A big thank for your help.
Greetings
TobyK

grafik

I would expect it to work... but I can't say it's a specific combination I've ever tested.

Could you share your example flow? I'll investigate next week.

Thanks for the response.

[
    {
        "id": "7e0db130af3023fb",
        "type": "subflow",
        "name": "level2",
        "info": "",
        "category": "",
        "in": [
            {
                "x": 140,
                "y": 160,
                "wires": [
                    {
                        "id": "5205d3ce0a7b11d2"
                    }
                ]
            }
        ],
        "out": [],
        "env": [],
        "meta": {},
        "color": "#DDAA99"
    },
    {
        "id": "cb683474f694958c",
        "type": "change",
        "z": "7e0db130af3023fb",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "#:(tofile)::level2",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 80,
        "wires": [
            [
                "0dfd1ab5128ccf38"
            ]
        ]
    },
    {
        "id": "0dfd1ab5128ccf38",
        "type": "debug",
        "z": "7e0db130af3023fb",
        "name": "level2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 80,
        "wires": []
    },
    {
        "id": "5205d3ce0a7b11d2",
        "type": "change",
        "z": "7e0db130af3023fb",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(tofile)::level2",
                "pt": "flow",
                "to": "level2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 380,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "ec161b52fcccc16c",
        "type": "inject",
        "z": "7e0db130af3023fb",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 210,
        "y": 80,
        "wires": [
            [
                "cb683474f694958c"
            ]
        ]
    },
    {
        "id": "b98a91283534ce8f",
        "type": "subflow",
        "name": "level1",
        "info": "",
        "category": "",
        "in": [
            {
                "x": 60,
                "y": 160,
                "wires": [
                    {
                        "id": "8599f276d85be9a9"
                    },
                    {
                        "id": "d116b8a8ed7b3499"
                    }
                ]
            }
        ],
        "out": [],
        "env": [],
        "meta": {},
        "color": "#DDAA99"
    },
    {
        "id": "d116b8a8ed7b3499",
        "type": "subflow:7e0db130af3023fb",
        "z": "b98a91283534ce8f",
        "name": "",
        "env": [],
        "x": 520,
        "y": 240,
        "wires": []
    },
    {
        "id": "9f077f1f577ad0ba",
        "type": "change",
        "z": "b98a91283534ce8f",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "#:(tofile)::level1",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 80,
        "wires": [
            [
                "2ffa5379e2e92a3a"
            ]
        ]
    },
    {
        "id": "2ffa5379e2e92a3a",
        "type": "debug",
        "z": "b98a91283534ce8f",
        "name": "level1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 760,
        "y": 80,
        "wires": []
    },
    {
        "id": "8599f276d85be9a9",
        "type": "change",
        "z": "b98a91283534ce8f",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(tofile)::level1",
                "pt": "flow",
                "to": "level1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 370,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "cccd01e20f14d038",
        "type": "inject",
        "z": "b98a91283534ce8f",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 200,
        "y": 80,
        "wires": [
            [
                "9f077f1f577ad0ba"
            ]
        ]
    },
    {
        "id": "67e8422ee554afd3",
        "type": "comment",
        "z": "b98a91283534ce8f",
        "name": "flow to msg payload",
        "info": "",
        "x": 550,
        "y": 20,
        "wires": []
    },
    {
        "id": "3cbe543c3d6d04d4",
        "type": "subflow:b98a91283534ce8f",
        "z": "f26c3086d2e77026",
        "name": "",
        "env": [],
        "x": 530,
        "y": 200,
        "wires": []
    },
    {
        "id": "6ad93daec4b7eeed",
        "type": "inject",
        "z": "f26c3086d2e77026",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "Write Data to File",
        "payloadType": "str",
        "x": 330,
        "y": 200,
        "wires": [
            [
                "3cbe543c3d6d04d4",
                "ecd555748fa21395"
            ]
        ]
    },
    {
        "id": "ecd555748fa21395",
        "type": "debug",
        "z": "f26c3086d2e77026",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 560,
        "y": 160,
        "wires": []
    }
]

and in the settings:

    contextStorage: {
		tofile: { module: "localfilesystem"},
    	default: { module: "memory" }
    },

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.