[SR-9518] Swift doesn't seem to correctly deinit some objects (5.0 snapshots, release mode) #51970
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
optimized only
Flag: An issue whose reproduction requires optimized compilation
Attachment: Download
Additional Detail from JIRA
md5: 6933683c4f7ddf0cbef9b51c845c5941
Issue Description:
Description
Our intregration tests started reporting leaks with Swift 5. They show 16 leaks per connection that is created which is odd because it never happened before. But still, why do I think this is a Swift bug and not a NIO bug:
only happens in release mode
MemoryGraphDebugger (see screenshot) shows the leaked objects but no incoming references
doesn't happen with all Swift 4.x versions
Repro
I attached a repro (tar.gz) which run in debug mode doesn't leak but it does leak in release mode. I tested with the Swift 5.0 dev snapshot from the 12th December:
happens on Mac & Linux.
instructions:
extra information
Here's the NIO PR that shows that the integration tests failed: apple/swift-nio#710
Here's the output of our allocation counter tests (with commentary)
we ran the 'make 1000 HTTP/1.1 requests over 1 connection (keep-alive)' allocated 38655 times in total and after the end, 16 allocations were not
free
'd. So probably 16 objects leaked. The repetitions are just because we re-run this 10 times.we ran the 'make 1 HTTP/1.1 request per connection but do 1000 connections, one after the other'. In total we allocated
693000
things and16000
of those didn't get free'd. That matches nicely with the 16 leaks above (1 connection) and now 16000 leaks (1000) connections.Further allocation counter tests:
The text was updated successfully, but these errors were encountered: