Skip to content

Commit

Permalink
fix bogus "unleakable promise leaked" error message (#2855) (#3027)
Browse files Browse the repository at this point in the history
### Motivation:

SwiftNIO contained a bogus error message:

```
BUG in SwiftNIO (please report), unleakable promise leaked.:486: Fatal error: leaking promise created at (file: "BUG in SwiftNIO (please report), unleakable promise leaked.", line: 486)
```

The actual meaning is that the ELG was shut down prematurely.

### Modifications:

- Replace the message with an accurate one

### Result:

- Users less confused
- fixes #2855
- fixes #2201
  • Loading branch information
weissi authored Dec 16, 2024
1 parent 47785ad commit ecfaa2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/NIOCore/EventLoopFuture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ public struct EventLoopPromise<Value> {
internal static func makeUnleakablePromise(eventLoop: EventLoop, line: UInt = #line) -> EventLoopPromise<Value> {
EventLoopPromise<Value>(
eventLoop: eventLoop,
file: "BUG in SwiftNIO (please report), unleakable promise leaked.",
file: """
EventLoopGroup shut down with unfulfilled promises remaining. \
This suggests that the EventLoopGroup was shut down with unfinished work outstanding which is \
illegal. Either switch to using the singleton EventLoopGroups or fix the issue by only shutting down \
the EventLoopGroups when all the work associated with them has finished.
""",
line: line
)
}
Expand Down

0 comments on commit ecfaa2c

Please sign in to comment.