question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bin/deletePad.js doesn't delete pads

See original GitHub issue

I have two hosts:

  • Host 1: Debian wheezy, nodejs v0.10.29, etherpad-lite v1.5.7 running on MySQL as its own user via bin/run.sh, settings.json and database tables have appropriate rights, everything works so far as expected.
  • Host 2: Debian unstable, node v4.2.4, etherpad-lite devel branch running on DirtyDB as my own user via bin/run.sh.

On both hosts, I have a pad named test which contains some text. I then want to delete that pad by doing a node bin/deletePad.sh test (or with a sudo -u etherpad before that in case of Host 1). Console output says it was deleted:

$ node ./bin/deletePad.js test
[2016-01-30 19:47:56.648] [WARN] console - DirtyDB is used. This is fine for testing but not recommended for production.
[2016-01-30 19:47:56.764] [DEBUG] ueberDB - REMOVE - pad:test
[2016-01-30 19:47:56.765] [DEBUG] ueberDB - SET    - pad:test - null - to database
[2016-01-30 19:47:56.767] [INFO] console - Finished deleting padId: test

(okay, the first line about DirtyDB is obviously missing on my production machine 😃)

No special output on the server console.

  • Expected outcome: the pad test is deleted and its original contents are gone after a browser refresh on the URL /p/test.
  • Actual outcome: I can still see the original contents of the pad test after a browser reload on the old URL. On Host 1, the MySQL table also still contains rows with key = “pad:test” OR key LIKE “pad:test:%”:
$ sudo -u etherpad node bin/deletePad.js test; sudo mysql --defaults-file=/etc/mysql/debian.cnf -e 'SELECT COUNT(*) FROM store WHERE store.key = "pad:test" OR store.key LIKE "pad:test:%";' etherpad 
[2016-01-30 19:37:00.529] [INFO] console - Finished deleting padId: test
+----------+
| COUNT(*) |
+----------+
|      501 |
+----------+

Also, on both hosts, deleting pads works via a HTTP call to /api/1/deletePad?apikey=$APIKEY&padID=test, I get {"code":0,"message":"ok","data":null} as a result. On Host 1, row count for the same MySQL query is 0 as expected. Server console in this case shows revisions being properly deleted:

[2016-01-30 20:17:17.689] [INFO] API - REQUEST, v1:deletePad, {"apikey":"myapikeyhere","padID":"test"}
[2016-01-30 20:17:17.690] [DEBUG] ueberDB - GET    - pad:test - {"atext":{"text":"asdfasdfasdf\n\n","attribs":"*0|1+d|1+1"},"pool":{"numToAttrib":{"0":["author","a.57oKb23lw2i2rdjk"]},"nextNum":1},"head":3,"chatHead":-1,"publicStatus":false,"passwordHash":null,"savedRevisions":[]} - from database 
[2016-01-30 20:17:17.690] [DEBUG] ueberDB - GET    - pad:test - {"atext":{"text":"asdfasdfasdf\n\n","attribs":"*0|1+d|1+1"},"pool":{"numToAttrib":{"0":["author","a.57oKb23lw2i2rdjk"]},"nextNum":1},"head":3,"chatHead":-1,"publicStatus":false,"passwordHash":null,"savedRevisions":[]} - from database 
[2016-01-30 20:17:17.690] [DEBUG] ueberDB - REMOVE - pad:test:revs:0
[2016-01-30 20:17:17.691] [DEBUG] ueberDB - SET    - pad:test:revs:0 - null - to database
[2016-01-30 20:17:17.691] [DEBUG] ueberDB - REMOVE - pad:test:revs:1
[2016-01-30 20:17:17.691] [DEBUG] ueberDB - SET    - pad:test:revs:1 - null - to database
[2016-01-30 20:17:17.691] [DEBUG] ueberDB - REMOVE - pad:test:revs:2
[2016-01-30 20:17:17.691] [DEBUG] ueberDB - SET    - pad:test:revs:2 - null - to database
[2016-01-30 20:17:17.691] [DEBUG] ueberDB - REMOVE - pad:test:revs:3
[2016-01-30 20:17:17.691] [DEBUG] ueberDB - SET    - pad:test:revs:3 - null - to database
[2016-01-30 20:17:17.692] [DEBUG] ueberDB - GET    - globalAuthor:a.57oKb23lw2i2rdjk - {"colorId":43,"name":null,"timestamp":1454181433086,"padIDs":{"test":1}} - from database 
[2016-01-30 20:17:17.692] [DEBUG] ueberDB - SET    - globalAuthor:a.57oKb23lw2i2rdjk - {"colorId":43,"name":null,"timestamp":1454181433086,"padIDs":{}} - to database
[2016-01-30 20:17:17.692] [DEBUG] ueberDB - GET    - pad2readonly:test - "r.9dd4dcb8d661dce2aef66e605152bad3" - from database 
[2016-01-30 20:17:17.692] [DEBUG] ueberDB - REMOVE - pad2readonly:test
[2016-01-30 20:17:17.692] [DEBUG] ueberDB - SET    - pad2readonly:test - null - to database
[2016-01-30 20:17:17.692] [DEBUG] ueberDB - REMOVE - readonly2pad:r.9dd4dcb8d661dce2aef66e605152bad3
[2016-01-30 20:17:17.693] [DEBUG] ueberDB - SET    - readonly2pad:r.9dd4dcb8d661dce2aef66e605152bad3 - null - to database
[2016-01-30 20:17:17.693] [DEBUG] ueberDB - REMOVE - pad:test
[2016-01-30 20:17:17.693] [DEBUG] ueberDB - SET    - pad:test - null - to database
[2016-01-30 20:17:17.693] [INFO] API - RESPONSE, deletePad, {"code":0,"message":"ok","data":null}
[2016-01-30 20:17:17.694] [DEBUG] SessionStore - SET aHl-K9iAXF_F_Bnozo3YX55y3fhQXGaM
[2016-01-30 20:17:17.694] [DEBUG] ueberDB - SET    - sessionstorage:aHl-K9iAXF_F_Bnozo3YX55y3fhQXGaM - {"cookie":{"path":"/","_expires":null,"originalMaxAge":null,"httpOnly":true}} - to database
[2016-01-30 20:17:17.695] [DEBUG] http - 200, GET /api/1/deletePad?apikey=5f3093258b305346e11bbc682225693f273854d5b5e357b9fa38a3ba71da273c&padID=test

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rhansencommented, Feb 16, 2021

As a workaround you can install the adminpads2 plugin, visit /admin/pads, and manually click the delete button.

Or you can write your own curl script to hit the deletePad API.

0reactions
rasoscommented, Feb 17, 2021

Thanks for the hints.

The adminpads2 plugin seems way too slow for our large etherpad instance, it took hours to show the pad and then did not delete it after clicking on the button.

This finally worked:

curl “https://ourinstance.net/api/1/deletePad?apikey=longsecret239b3f1&padID=Myseminarpad

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript delete object property not working - Stack Overflow
If the object inherits a property from a prototype, and doesn't have the property itself, the property can't be deleted by referencing the...
Read more >
delete operator - JavaScript - MDN Web Docs - Mozilla
The delete operator removes a property from an object. If the property's value is an object and there are no more references to...
Read more >
5 things you need to know about the delete operator in ...
In JavaScript, the delete operator is employed to delete a property of an object. After deleting the actual property, that property won't be ......
Read more >
JavaScript delete Operator - Pi My Life Up
The delete operator is used in JavaScript to remove a property from an object. A property is a part of an object with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found