untu / comedy

Node.js actor framework.
Eclipse Public License 1.0
653 stars 36 forks source link

TypeError: Cannot read property 'send' of undefined #47

Open ciricc opened 4 years ago

ciricc commented 4 years ago

When i use forked actors, i got this error (and don't know why and where)

Error occurring at /var/www/scripts/node_modules/comedy/lib/forked-actor.js:476:18

Full error:

TypeError: Cannot read property 'send' of undefined at /var/www/scripts/node_modules/comedy/lib/forked-actor.js:476:18 at Promise._execute (/var/www/scripts/node_modules/comedy/node_modules/bluebird/js/release/debuggability.js:299:9) at Promise._resolveFromExecutor (/var/www/scripts/node_modules/comedy/node_modules/bluebird/js/release/promise.js:481:18) at new Promise (/var/www/scripts/node_modules/comedy/node_modules/bluebird/js/release/promise.js:77:14) at ForkedActorParent._send0 (/var/www/scripts/node_modules/comedy/lib/forked-actor.js:421:12) at ForkedActorParent.transmitBusMessage (/var/www/scripts/node_modules/comedy/lib/forked-actor.js:108:10) at /var/www/scripts/node_modules/comedy/lib/system-bus.js:82:19 at Set.forEach (<anonymous>) at SystemBus._broadcastToForkedRecipients (/var/www/scripts/node_modules/comedy/lib/system-bus.js:80:21) at SystemBus.emitFromActor (/var/www/scripts/node_modules/comedy/lib/system-bus.js:44:10) at ChildProcess.<anonymous> (/var/www/scripts/node_modules/comedy/lib/forked-actor.js:274:25) at ChildProcess.emit (events.js:314:20) at emit (internal/child_process.js:906:12) at processTicksAndRejections (internal/process/task_queues.js:81:21)

My architicture: Forked actor running children forked actors (4), and each child running own one threaded and one forked actors. I am using bus for messaging between them.

My solution: If i change this chain Forked -> Forked -> Forked to this Forked -> Forked -> Threaded it will be ok. But i need only Forked -> Forked -> Forked

weekens commented 4 years ago

Hi @ciricc ! I will have a look at it in near time. Is it happening on attempt to send a message through bus?

ciricc commented 4 years ago

Yes It happens only when i use it with many child threaded actors in one. (sendAndReceive)