jo / couch-daemon

High-level os daemon API for CouchDB.
14 stars 2 forks source link

Deleted db cause couch-daemon to crash #15

Closed ejeklint closed 10 years ago

ejeklint commented 10 years ago

Tested with example "logger": delete a watched db and BOOM.

jo commented 10 years ago

I was able to reproduce it:

couch-daemon/examples/logger.js:18
        if (data.stream === 'dbs') {
                ^
TypeError: Cannot read property 'stream' of undefined
    at couch-daemon/examples/logger.js:18:17

I will have a look at it.

jo commented 10 years ago

At my private laptop I am not able to reproduce the error. Also creation and deletion of dbs while listening is already covered by a test.

I have verified it with the following curl session:

[jo@localhost ~]$ curl -XPUT localhost:5984/asd
{"ok":true}
[jo@localhost ~]$ curl -XPUT localhost:5984/asd/efg -d '{}'
{"ok":true,"id":"efg","rev":"1-967a00dff5e02add41819138abb3284d"}
[jo@localhost ~]$ curl -XDELETE localhost:5984/asd
{"ok":true}
[jo@localhost ~]$ 

while couch-daemon was running:

[jo@localhost couch-daemon]$ ./examples/logger.js --whitelist asd
[Tue Jun 24 2014 21:12:26 GMT+0200 (CEST)] [info] Daemon "couch-daemon-example-logger" :: listening on: asd
[Tue Jun 24 2014 21:12:29 GMT+0200 (CEST)] [info] Daemon "couch-daemon-example-logger" :: processing (1): asd/efg@1
[Tue Jun 24 2014 21:12:32 GMT+0200 (CEST)] [info] Daemon "couch-daemon-example-logger" :: listening on: as
ejeklint commented 10 years ago

Fixed by cleaning dependencies.