dominictarr / scuttlebutt

peer-to-peer replicatable data structure
Other
1.32k stars 66 forks source link

fix a bug with variable 'sources' getting an undefined value #28

Closed pkrumins closed 11 years ago

pkrumins commented 11 years ago

We just moved to the latest seaport that uses scuttlebutt in prodution at Browserling and seaport started crashing in a repeated loop:

/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/node_modules/scuttlebutt/index.js:212
    sources[source] = ts
                    ^
TypeError: Cannot set property '58C75509F2D2444F74A4AC93' of undefined
    at Doc.onUpdate (/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/node_modules/scuttlebutt/index.js:212:21)
    at Doc.EventEmitter.emit (events.js:115:20)
    at Doc.applyUpdate (/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/doc.js:218:8)
    at didVerification (/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/node_modules/scuttlebutt/index.js:97:13)
    at Doc.sb._update (/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/node_modules/scuttlebutt/index.js:111:5)
    at Doc.sb.localUpdate (/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/node_modules/scuttlebutt/index.js:58:8)
    at Row.track (/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/doc.js:93:9)
    at Row.EventEmitter.emit (events.js:91:17)
    at Row._set (/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/row.js:47:8)
    at Row.set (/home/ec2-user/projects/browserling-seaport-fix/bouncer/node_modules/seaport/node_modules/crdt/row.js:30:8)
Forever detected script exited with code: 1
Forever restarting script for 24 time

This patch fixes this problem. Thank you!

dominictarr commented 11 years ago

cool, merging.

dominictarr commented 11 years ago

merged into 5.6.8