etherpad-lite: Uncaught TypeError: Cannot read property 'setStateIdle' of null

I’m getting the following error in Chrome 66 when accessing a pad in our instance (running 1.6.6). Meanwhile, access with Firefox 60 works without problems. Any tips?

An error occurred
The error was reported with the following id: 'qZF4pJdMtrdhNgDJlfp0'

Please press and hold Ctrl and press F5 to reload this page, if the problem persists please send this error message to your webmaster:
'ErrorId: qZF4pJdMtrdhNgDJlfp0
URL: https://pad.example.com/padname
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
Uncaught TypeError: Cannot read property 'setStateIdle' of null in https://pad.example.com/javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define at line 3'

It seems to stem from this code section, where pad.collabClient seems to be null:

            socket.on("error", function(e) {
                pad.collabClient.setStateIdle(),
                pad.collabClient.setIsPendingRevision(!0)
            });

When pausing with a breakpoint, the error e is undefined.

According to the call stack, the error occurred in this call:

            io.connect(n, {
                path: exports.baseURL + "socket.io",
                resource: a,
                reconnectionAttempts: 5,
                reconnection: !0,
                reconnectionDelay: 1e3,
                reconnectionDelayMax: 5e3
            })

P.S.: It’s actually suprising that pad.collabClient is already used in the handshake(), while it is only initialized in _afterHandshake().

P.P.S.: Troubleshooting information as follows:

Etherpad version

Version number: 1.6.6

Git sha: 7e69a82
Installed plugins

ep_etherpad-lite

Installed parts

ep_etherpad-lite/swagger
ep_etherpad-lite/adminsettings
ep_etherpad-lite/adminplugins
ep_etherpad-lite/admin
ep_etherpad-lite/tests
ep_etherpad-lite/socketio
ep_etherpad-lite/errorhandling
ep_etherpad-lite/importexport
ep_etherpad-lite/apicalls
ep_etherpad-lite/webaccess
ep_etherpad-lite/padreadonly
ep_etherpad-lite/padurlsanitize
ep_etherpad-lite/specialpages
ep_etherpad-lite/i18n
ep_etherpad-lite/static
ep_etherpad-lite/express

Installed hooks
Server side hooks

expressCreateServer
    ep_etherpad-lite/node/hooks/express/swagger:expressCreateServer from ep_etherpad-lite/swagger
expressCreateServer
    ep_etherpad-lite/node/hooks/express/adminsettings:expressCreateServer from ep_etherpad-lite/adminsettings
expressCreateServer
    ep_etherpad-lite/node/hooks/express/adminplugins:expressCreateServer from ep_etherpad-lite/adminplugins
expressCreateServer
    ep_etherpad-lite/node/hooks/express/admin:expressCreateServer from ep_etherpad-lite/admin
expressCreateServer
    ep_etherpad-lite/node/hooks/express/tests:expressCreateServer from ep_etherpad-lite/tests
expressCreateServer
    ep_etherpad-lite/node/hooks/express/socketio:expressCreateServer from ep_etherpad-lite/socketio
expressCreateServer
    ep_etherpad-lite/node/hooks/express/errorhandling:expressCreateServer from ep_etherpad-lite/errorhandling
expressCreateServer
    ep_etherpad-lite/node/hooks/express/importexport:expressCreateServer from ep_etherpad-lite/importexport
expressCreateServer
    ep_etherpad-lite/node/hooks/express/apicalls:expressCreateServer from ep_etherpad-lite/apicalls
expressCreateServer
    ep_etherpad-lite/node/hooks/express/padreadonly:expressCreateServer from ep_etherpad-lite/padreadonly
expressCreateServer
    ep_etherpad-lite/node/hooks/express/padurlsanitize:expressCreateServer from ep_etherpad-lite/padurlsanitize
expressCreateServer
    ep_etherpad-lite/node/hooks/express/specialpages:expressCreateServer from ep_etherpad-lite/specialpages
expressCreateServer
    ep_etherpad-lite/node/hooks/i18n:expressCreateServer from ep_etherpad-lite/i18n
expressCreateServer
    ep_etherpad-lite/node/hooks/express/static:expressCreateServer from ep_etherpad-lite/static
socketio
    ep_etherpad-lite/node/hooks/express/adminsettings:socketio from ep_etherpad-lite/adminsettings
socketio
    ep_etherpad-lite/node/hooks/express/adminplugins:socketio from ep_etherpad-lite/adminplugins
expressConfigure
    ep_etherpad-lite/node/hooks/express/webaccess:expressConfigure from ep_etherpad-lite/webaccess
createServer
    ep_etherpad-lite/node/hooks/express:createServer from ep_etherpad-lite/express
restartServer
    ep_etherpad-lite/node/hooks/express:restartServer from ep_etherpad-lite/express

Client side hooks

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 34 (19 by maintainers)

Most upvoted comments

Good news, @fralix. Good documentation is precious.

I leave the issue open, since I continue being curious about the “phantom” initialization uncovered by @caugner.

I am starting to think about how to improve the codebase without rewriting it (more tests, linters, static analyzers, maybe even gradually migrating to TypeScript…), and this sort of issues interest me a lot.

This error is reproduced on different instances of the etherpads in the android and chrome. Tested on my own server and on https://etherpad.wikimedia.org, https://video.etherpad.com.

An error occurred Please press and hold Ctrl and press F5 to reload this page If the problem persists please send this error message to your webmaster:

ErrorId: XDmLq2ENraoB3lM4ESfu URL: https://etherpad.wikimedia.org/p/gxz0C7Rncg-J80ra7DQw UserAgent: Mozilla/5.0 (Linux; Android 10; Mi A2 Lite) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36 Uncaught TypeError: Cannot read property ‘setStateIdle’ of null in https://etherpad.wikimedia.org/javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define&v=f2b033c9 at line 3

Steps to reproduce

  1. in chrome browser open a new pad
  2. write something
  3. then click on “home” in the android
  4. then through the “last applications” close everything
  5. and run chrome browser again
  6. it will start to open your last pad and give this error