Bob Is Unhappy - Hundreds of Attempts to Read fields of undefined

107 views
Skip to first unread message

Kevin Kleinfelter

unread,
Sep 29, 2019, 8:30:57 PM9/29/19
to TiddlyWiki
Bob is deeply unhappy.  He's said so 93,494 times this weekend.  (I counted.) Here's how he puts it:

saved file with metadata /usr/local/lib/node_modules/tiddlywiki/Wikis/pkb/tiddlers/Connecting to Boxtop3.md

WebSocket error:  TypeError: Cannot read property 'fields' of undefined

    at Object.$tw.nodeMessageHandlers.syncChanges ($:/plugins/OokTech/Bob/NodeMessageHandlers.js:447:84)

    at WebSocket.$tw.Bob.handleMessage ($:/plugins/OokTech/Bob/NodeWebSocketsSetup.js:151:52)

    at WebSocket.emit (events.js:209:13)

    at Receiver.receiverOnMessage ($:/plugins/OokTech/Bob/External/WS/lib/websocket.js:720:20)

    at Receiver.emit (events.js:209:13)

    at Receiver.dataMessage ($:/plugins/OokTech/Bob/External/WS/lib/receiver.js:415:14)

    at Receiver.getData ($:/plugins/OokTech/Bob/External/WS/lib/receiver.js:347:17)

    at Receiver.startLoop ($:/plugins/OokTech/Bob/External/WS/lib/receiver.js:134:22)

    at Receiver._write ($:/plugins/OokTech/Bob/External/WS/lib/receiver.js:70:10)

    at doWrite (_stream_writable.js:428:12)



I dunno how to read a Node.js crash dump, but it looks like maybe after Node heard how unhappy Bob is, Node took its own life.  Perhaps "failure scavenge might not succeed" means that Node ran out of heap space?



<--- Last few GCs --->


[9:0x41de780]  5442977 ms: Scavenge 2039.1 (2052.4) -> 2037.7 (2052.7) MB, 5.5 / 0.0 ms  (average mu = 0.341, current mu = 0.371) allocation failure

[9:0x41de780]  5442995 ms: Scavenge 2039.4 (2052.7) -> 2038.0 (2052.9) MB, 5.2 / 0.0 ms  (average mu = 0.341, current mu = 0.371) allocation failure

[9:0x41de780]  5444515 ms: Mark-sweep 2039.7 (2052.9) -> 2038.3 (2057.2) MB, 1506.4 / 0.0 ms  (average mu = 0.274, current mu = 0.189) allocation failure scavenge might not succeed



<--- JS stacktrace --->


==== JS stack trace =========================================


    0: ExitFrame [pc: 0x134e879]

    1: StubFrame [pc: 0x138db9a]

Security context: 0x3e4a99640919 <JSObject>

    2: from [0x6a80a44ae89] [buffer.js:~270] [pc=0xb812c263255](this=0x221b0eaff619 <JSFunction Buffer (sfi = 0x39f0ffe76749)>,0x190592280179 <String[70]: {"type":"updateEditingTiddlers","list":[],"wiki":"pkb","id":"s247472"}>,0x0564139c04d1 <undefined>,0x0564139c04d1 <undefined>)

    3: send [0x1b67e01069c9] [$:/plugins/OokTech/B...

TonyM

unread,
Sep 29, 2019, 9:13:59 PM9/29/19
to TiddlyWiki
Kevin

I can't help you on this except to suggest you need to describe the context, when, what, how, were you doing the last thing can you repeat it?, are you trying something "special".

Regards
Tony

Kevin Kleinfelter

unread,
Sep 29, 2019, 9:19:36 PM9/29/19
to TiddlyWiki
It happens after I click the reconnect button.  When I tail the log file, things look OK at first.  Then, something causes a disconnect.  The log file still looks OK.  Then I press the reconnect button, and Bob goes into his stuck record routine, showing the websocket error over and over again.  Reminds me a little of my first wife.  ;-)

The only way to prevent him running that loop for thousands of times is to reload the page.

At this time I am *not* running through the corporate proxy I mentioned in another post.  This is browser to Apache reverse-proxy (to handle SSL with basic auth) to Bob.

It looks like I'm going to have to revert from Bob back to plain Tiddlywiki.

Kevin Kleinfelter

unread,
Sep 29, 2019, 10:22:47 PM9/29/19
to TiddlyWiki
I think I can force it to happen.

  • Starting from a happy Bob session in Firefox.
  • Stop and start my Apache reverse proxy.  That puts the "WARNING: You are no longer connected to the server" banner on the browser.
  • Tail the Tiddlywiki logs.  No lines are being written to the log at this instant (lots of old stuff there).
  • Press Reconnect.  Bob begins writing WebSocket error to the log at the rate of 1-2 errors per second.

Reloading the page in Firefox stops the errors.


Jed Carty

unread,
Sep 30, 2019, 5:23:07 AM9/30/19
to TiddlyWiki
If the server restarts you have to reload the window. The reconnect only works when the client browser gets disconnected and wants to reconnect. I made the functionality when I had an intermittent internet connection because I was annoyed. I haven't done much to update it since then.

Kevin Kleinfelter

unread,
Sep 30, 2019, 11:06:34 AM9/30/19
to TiddlyWiki
I'm not troubled by having to restart the browser after a server restart.  That's reasonable.

The two things which trouble me are:
  • The TW/Bob server crashes.  That's a problem for me when I'm away from home because I can't always ssh into the host to restart it.  (I'm reluctant to configure it to auto-restart because of the risk of runaway restarts impacting other services.)
  • I can't tell whether the data is saved or not.
Bob brings some real value to the table.  I really like the synch with file system and the instant wiki creation.

There are enough cases where data is silently lost that I can't trust Bob.  It's the silent part I can't get past.  (Yeah, TW *always* says data might be lost, but since I can't tell the difference between a spurious warning and real data loss, there's no useful notification.)

When I finish the big project I'm working on, I'll try and take a look at the code.  If I could set the diskette/save icon to red when a tiddler goes into the save queue, and set it to black when the save queue goes empty, that would do it.

@TiddlyTweeter

unread,
Sep 30, 2019, 11:33:12 AM9/30/19
to TiddlyWiki
There are enough cases where data is silently lost that I can't trust Bob.  

Interesting comments.

I do think Bob is quite complex. And Jed has not, really, had enough ongoing feedback.

FYI, the main probelms I had were on relative addressing. 

IMO to get BOB optimal we need lots of feedback so Jed can be aware of issues.

Your comments are relevant.

Best wishes
TT

Kevin Kleinfelter

unread,
Sep 30, 2019, 5:34:43 PM9/30/19
to TiddlyWiki
Having looked at the code a bit between meetings, maybe the unsaved data indicator could be handled by a plugin.  Something like (pseudocode):

    $tw.settings.heartbeat.indicator = setInterval(function () {
        if there is an '$:/plugins/OokTech/Bob/Unsent' tiddler with content {
            $tw.utils.toggleClass(document.body,"tc-dirty",true);
        } else {
            $tw.utils.toggleClass(document.body,"tc-dirty",false);
        }
    }, $tw.settings.heartbeat.interval);

"with content" is interesting.  Unsent is sometimes non-existent, sometimes it contains only "[]", and other times I think it contains JSON.

I'm not certain of any of this.  It's been years since I wrote any real code.

Kevin Kleinfelter

unread,
Sep 30, 2019, 6:45:19 PM9/30/19
to TiddlyWiki
I am (clearly) not a programmer and (clearly) not familiar with how to program for Tiddlywiki, but here's what I came up with.
(function(){
    exports.name = "test1";
    exports.platforms = ["browser"];
    exports.after = ["story"];
    exports.synchronous = true;

    exports.startup = function() {
        setInterval(function () {
            tiddler = $tw.wiki.getTiddler('$:/plugins/OokTech/Bob/Unsent');
            if (tiddler) {
                $tw.utils.toggleClass(document.body,"tc-dirty",true);
            }
        }, 500);

    }
})();

There's something else setting the document class to clean about once a second.  (Maybe the ping?)  The effect is that when the Unsent tiddler exists, the save icon flashes.  It doesn't handle the case where Unsent is an empty array, but, as I said, I'm not a programmer any longer.


Kevin Kleinfelter

unread,
Sep 30, 2019, 7:17:19 PM9/30/19
to TiddlyWiki
Oops.  Another issue can cause Bob to lose data.  I wanted to simulate dropping out of WiFi coverage, to test Bob.  I loaded TW+Bob, I turned off my WiFi, I created a tiddler, I turned WiFi back on.

Bob never put up the disconnected warning and $:/plugins/OokTech/Bob/Unsent shows that he's holding the tiddler I created while offline.  Even after I'm back online, he just keeps holding it.  But I've now got a red save icon to tell me I'm about to lose my data.  :-\

I had hoped to be able to use TW+Bob for seamless online/offline work, but we're not ready for that.
Reply all
Reply to author
Forward
0 new messages