Stack buffer overflow error using JSONDecoder

I'm using JSONDecoder().decode(T.Type, from: data) to decode a JSON response from a server. It works in some cases but eventually my program crashes with the error "Stack buffer overflow".

The size of the JSON data I'm trying to decide is about 16k, which is large, but not unusually so.

The decode is happening in a non-main thread, but I tried pushing it into the main thread with the same results.

Most of these crashes occur in the simulator rather than on a real device, but I'd like to figure out the problem anyway.

I thought I'd try dispatching the work into a queue with a larger stack size, but I couldn't figure out how to make one. Is it possible?

Thanks, Frank

It sounds like you can reproduce this in your office. If so, are you able to capture a specific JSON file that reliably triggers the problem?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Stack buffer overflow error using JSONDecoder
 
 
Q