Wappler crashing on parsing burst of multiple docker events

Wappler crashing every few hours for unknown reason
MacOS (M3)
Wappler v6.8.0
image

How do I get report ID for you to check?

I've analyzed your crash logs and found our that a lot of docker events occur with wrong json structure. This leads to so many parsing errors that eventually you run out of memory.

So there is seems to be something wrong with your docker. Maybe try updating it or installing from scratch to see if that helps.

If you inspect the Wappler logs (when started with logging) you can see the docker errors, they are something like:

{
message: Unexpected non-whitespace character after JSON at position 1457 (line 2 column 1), 
name: SyntaxError, 
stack: 
SyntaxError: Unexpected non-whitespace character after JSON at position 1457 (line 2 column 1)
    at JSON.parse (<anonymous>)
    at w2editor_ftp_manager.parseDockerEvent (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/w2editor_ftp_manager.js:1:68782)
    at w2editor_ftp_manager.onDockerEvents (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/w2editor_ftp_manager.js:1:68330)
    at IncomingMessage.emit (node:events:514:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at IncomingMessage.push (node:internal/streams/readable:234:10)
    at HTTPParser.parserOnBody (node:_http_common:131:24)
    at Socket.socketOnData (node:_http_client:541:22)
    at Socket.emit (node:events:514:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Socket.push (node:internal/streams/readable:234:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
}

I updated Docker Desktop, factory reset, uninstalled, installed, still having the same error :frowning:

what is your Docker version - and does the error happens only on your local development only? - What about different project?

When you did reset docker did you clear all local images and containers? There might be a faulty container

My Docker version is 4.34.0

After a bit of switching projects, I found the issue only happens with this container:

  maildev:
    image: 'maildev/maildev'
    ports:
      - '1080:1080'

Something to do with the container healthchecks I guess, as those are the docker events that are streamed (as far as I could see using docker system events). Could you add that container to a project of yours and see what's going on with the Docker events?

Yes

I'm only using Docker in local development

If it helps, i was getting the same error "Unexpected white space chatactergafter JSON..." message when developing onesignal modules.
After much head scratching it actually turned out to be related to authorisation settings being wrong.

@George JSON event parse fails because two events come at the same time, separated by newline (JSONL). There's nothing wrong with the Docker JSON, the problem is how you handle incoming Docker events.

And when this parsing fails, the variable e (?) keeps growing with pending data to be parsed, and it runs out of memory.

I confirmed this by modifying parseDockerEvent to console.log additional data:

        parseDockerEvent: function (e) {
            try {
                return JSON.parse(e)
            } catch (err) {
                console.log("parse of event failed: ", err)
                console.log("event: ", e)
            }
        },

The console.log of the event keeps getting bigger and bigger

Could you fix it, please?

1 Like

I wanna thank me for being an advanced user so I could workaround and avoid having to work with Wappler crashing every hour after waiting a week for a bug fix :laughing:

Fortunately for others, this is a rare bug.

3 Likes

I will send you a PM with possible fix.

Fixed in the latest extensions updates.

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