Skip to content

EXC_BAD_ACCESS in OpLogDistributedReceptionist #1140

@akbashev

Description

@akbashev

Description
When playing with nodes and dynamically adding and removing them distributed system crashes with EXC_BAD_ACCESS in OpLogDistributedReceptionist (see screenshot and backtrace).

Not sure if it's helpful ore not, but if you fix logic by removing __secretlyKnownToBeLocal and assuming it's not local—it will stop crashing, so assume concurrency issue, though not sure if Swift itself or logic.

Steps to reproduce
Run any simple project with two nodes (e.g. #1139) and simultaneously initialise, join them and create actors without waiting to be up (not the best logic ofc, but at least a way to simulate a crash).
For me it crashes almost every time (if not just try close/run several times more). Think key point is to start firing multiple dead letters.

Environment
macOS 14, Xcode 15.0.1 (15A507)

Backtrace

* thread #80, queue = 'com.apple.root.default-qos.cooperative', stop reason = EXC_BAD_ACCESS (code=1, address=0x8000000000000008) frame #0: 0x000000019032290c libswiftCore.dylib`swift_isUniquelyReferenced_nonNull_native frame #1: 0x000000018ffe52c8 libswiftCore.dylib`Swift.Dictionary._Variant.removeValue(forKey: τ_0_0) -> Swift.Optional<τ_0_1> + 660 * frame #2: 0x0000000100b68594 Server`$defer #1 (self=0x0000000145205320, timerTaskKey=-2452856007130675400) in closure #1 in OpLogDistributedReceptionist.ensureDelayedListingFlush(of:) at OperationLogDistributedReceptionist.swift:488:62 frame #3: 0x0000000100b682f4 Server`closure #1 in OpLogDistributedReceptionist.ensureDelayedListingFlush(self=<no summary available>, timerTaskKey=-2452856007130675400, flushDelay=(_low = 250000000000000000, _high = 0), key=(id = "persistences", guestType = Any)) at OperationLogDistributedReceptionist.swift:494:38 frame #4: 0x0000000100b6f628 Server`partial apply for closure #1 in OpLogDistributedReceptionist.ensureDelayedListingFlush(of:) at <compiler-generated>:0 

Screenshot
Screenshot 2023-10-20 at 14 20 20

Metadata

Metadata

Assignees

Labels

kind/bugFeature doesn't work as expected.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions