Skip to content

effect/cluster Infinite recursion in Rpc notify for BigDecimal type #6173

@arijoon

Description

@arijoon

What version of Effect is running?

ec5c505

What steps can reproduce the bug?

Reproducing bug in a test case: arijoon#2

Leads to

timestamp=2026-04-14T15:37:49.437Z level=DEBUG fiber=#61 message="Fiber terminated with an unhandled error" cause="RangeError: Maximum call stack size exceeded
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:241:16)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:422:7)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:422:7)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:422:7)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:422:7)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)"
timestamp=2026-04-14T15:37:49.441Z level=DEBUG fiber=#2 message="Shutting down" cause="RangeError: Maximum call stack size exceeded
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:241:16)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:422:7)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:422:7)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:422:7)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)
    at pack (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:422:7)
    at Packr.writeRecord (file:///code/vendor/effect/node_modules/.pnpm/msgpackr@1.11.4/node_modules/msgpackr/pack.js:709:6)" module=Sharding package=@effect/cluster

The issue only happens if a socket connection exists between the client and the runner, the sql messages still persist just fine. Additionally sql/storage messages persist fine but the call to the entity from client will always Die

What is the expected behavior?

Either

  • Typed error for the socket failure but sql/storage success
  • Encoding the message to avoid any serialisation issues since the message has a schema where BigDecimal's encoded form will be a string

What do you see instead?

Defect crashing the flow on the call to the client

Additional information

Originally found this issue on an older version of cluster where shard manager exists, but it behaves the same on latest branch as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions