Skip to content

copyPad + revertPad causes server crash #2930

@g-borgulya

Description

@g-borgulya
  1. create a pad, edit it, etc.
  2. call the copyPad API method to create a copy
  3. edit the new pad
  4. call the revertPad API method and try to revert back to any revision
  5. server crash:
[2016-03-19 20:45:52.154] [INFO] API - REQUEST, v1.2.12:restoreRevision, {"apikey":"something","padID":"something","rev":"458"}
[2016-03-19 20:45:52.192] [INFO] access - [LEAVE] Pad "something": Author "a.jaVrDS1RUXiRmvE1" on client 8S1JASyA09kx5EJFAAAE with IP "127.0.0.1" left the pad
[2016-03-19 20:45:52.224] [INFO] API - RESPONSE, restoreRevision, {"code":2,"message":"internal error","data":null}
[2016-03-19 20:45:52.227] [ERROR] console - Async Stacktrace:
    at etherpad-lite/src/node/handler/APIHandler.js:613:7
    at etherpad-lite/src/node/db/API.js:823:11
    at etherpad-lite/src/node/db/Pad.js:236:8

Error: Not a exports: null
    at Object.error (etherpad-lite/src/static/js/Changeset.js:39:11)
    at Object.exports.unpack (etherpad-lite/src/static/js/Changeset.js:874:13)
    at Object.exports.applyToText (etherpad-lite/src/static/js/Changeset.js:913:26)
    at Object.exports.applyToAText (etherpad-lite/src/static/js/Changeset.js:1621:19)
    at etherpad-lite/src/node/db/Pad.js:226:29
    at etherpad-lite/src/node_modules/async/lib/async.js:610:21
    at etherpad-lite/src/node_modules/async/lib/async.js:249:17
    at iterate (etherpad-lite/src/node_modules/async/lib/async.js:149:13)
    at etherpad-lite/src/node_modules/async/lib/async.js:160:25
    at etherpad-lite/src/node_modules/async/lib/async.js:251:21
[2016-03-19 20:45:52.228] [INFO] console - graceful shutdown...
[2016-03-19 20:45:52.242] [INFO] ueberDB - Flushed 2 values
[2016-03-19 20:45:52.344] [INFO] ueberDB - Flushed 1 values
[2016-03-19 20:45:52.446] [INFO] console - db sucessfully closed.

I'm adding some custom line- and normal attributes to the pads I'm playing with, I don't see if it should be the reason.

I guess there's a problem that's connecting: if you do the steps 1-3. and call pad.getInternalRevisionAText to an early revision I also get an error:

[2016-03-19 20:57:58.512] [INFO] console -{ [Error: atext is null] easysync: true }
Async Stacktrace:
   at /etherpad-lite/src/node/db/Pad.js:236:8

Error: atext is null
   at Object.error (/etherpad-lite/src/static/js/Changeset.js:39:11)
   at Object.exports.cloneAText (/etherpad-lite/src/static/js/Changeset.js:1636:18)
   at Object.callback (/etherpad-lite/src/node/db/Pad.js:192:33)
   at /etherpad-lite/src/node_modules/ueberdb2/CloneAndAtomicLayer.js:139:17
   at /etherpad-lite/src/node_modules/ueberdb2/CacheAndBufferLayer.js:365:7
   at /etherpad-lite/src/node_modules/ueberdb2/CacheAndBufferLayer.js:185:7
   at null.callback (/etherpad-lite/src/node_modules/ueberdb2/postgres_db.js:78:5)
   at Query.handleReadyForQuery (/etherpad-lite/src/node_modules/ueberdb2/node_modules/pg/lib/query.js:80:10)
   at null.<anonymous> (/etherpad-lite/src/node_modules/ueberdb2/node_modules/pg/lib/client.js:158:19)
   at EventEmitter.emit (events.js:117:20)

I tried to use the expressCreateServer hook when I got this second error, like this:

var padManager = require("ep_etherpad-lite/node/db/PadManager");

args.app.get('/p/:pad/:rev?/export/myStuff', function (req, res, next) {
    getMyStuff (padID, revision, function (err, result) {
        res.contentType ('application/json');
        res.send (result);
    });

}

var getMyStuff = function (padId, revNum, callback) {
    padManager.getPad (padId, function (err, pad) {
        if (ERR (err, callback)) return;
        if (revNum != undefined) {
            pad.getInternalRevisionAText (revNum, function (err, revisionAtext) {
                console.info (err);
...
            });
        }
    });
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions