fluent: Crash under full load: NIO-ELT-#1 (5): EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

On any save operation, using FluentMySQL or FluentPostgreSQL, calling the route in an infinite loop several times in background processes results in NIO-ELT-#1 (5): EXC_BAD_ACCESS (code=EXC_I386_GPFLT). screen shot 2018-05-19 at 00 45 13 screen shot 2018-05-19 at 00 01 44

Sample loop script:

while [ 1 ]
do
curl --request POST \
  --url http://localhost:8080/polls \
  --header 'content-type: application/json' \
  --data '{
                "question": "Okay?",
                "startDate": 123,
                "endDate": 456
}'
done

After enabling Thread Sanitizer, I got this additional piece of info:

WARNING: ThreadSanitizer: data race (pid=98333)
  Write of size 8 at 0x000101bcc320 by thread T5:
    #0 RFC1123DateCache.currentTimestamp() RFC1123.swift:64 (HTTP:x86_64+0x79ea9)
    #1 HTTPServerHandler.serialize(_:for:ctx:) HTTPServer.swift:226 (HTTP:x86_64+0x6fda9)
    #2 closure #1 in HTTPServerHandler.respond(to:body:ctx:) HTTPServer.swift:213 (HTTP:x86_64+0x6f964)
...

Full trace in Pastebin

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (15 by maintainers)

Most upvoted comments

Thank you for the thread sanitizer info. It indeed looks like RFC1123DateCache would need to be thread-local or synchronized-access.

Done. 😄

We should probably fix whatever threading issues our UUID generator has in a separate PR. Should we leave this issue open for now to keep investigating that part as well?

That sounds good. I’ll move on to investigating the UUID generation as well.