Giter VIP home page Giter VIP logo

urlsessionbackport's People

Contributors

dimitribouniol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

urlsessionbackport's Issues

Using URLSession.backport.bytes(for:) causing crash

First at all, thanks a lot for taking the time to create a library that backports the async/await versions of URLSession to iOS 14.

I am currently implementing some feature based on URLSession.bytes(for:) in my codebase. I still need to support iOS 14 and therefore found your library. In general the port works, but unfortunately not reliably. I often face crashes related to EXC_BAD_ACCESS or SIGABRT. When using an iOS 15 simulator, and therefore using the system provided methods the crash is not appearing,

I already tried to debug it a little, and it always crashes within the DataAccumulator. But at random places. Sometimes when data is added to the internal buffer or sometimes when reading from it. But the place seems to be random. I assume that there are some race conditions when the data receival is ending.

  • Maybe the .success case is already causing the data accumulator to be deallocated but another continuation is still running ?
  • Or maybe some other race condition is occuring, not sure unfortunately :/

Some examplary stack trace:

First Example

2022-06-20 21:03:10.358559+0200 URLSessionBackportTest[24786:502404] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
URLSessionBackportTest(24786,0x700007ae8000) malloc: Incorrect checksum for freed object 0x7f807c40f288: probably modified after being freed.
Corrupt value: 0xffffffe00000000
URLSessionBackportTest(24786,0x700007ae8000) malloc: *** set a breakpoint in malloc_error_break to debug
URLSessionBackportTest(24786,0x700007ae8000) malloc: Incorrect checksum for freed object 0x7f807c40f288: probably modified after being freed.
Corrupt value: 0xffffffe00000000
CoreSimulator 802.6.1 - Device: iPhone 8 Plus (250B5764-5BFD-440B-A918-82B557B5A993) - Runtime: iOS 14.5 (18E182) - DeviceType: iPhone 8 Plus
(lldb) 

In the stack trace it can also be the seen where from the DataAccumulator this comes from:

Screenshot 2022-06-20 at 21 32 36

Second Example

2022-06-20 21:36:20.604135+0200 URLSessionBackportTest[26678:539387] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
URLSessionBackportTest(26678,0x70000a1da000) malloc: Incorrect checksum for freed object 0x7fe7d9905d18: probably modified after being freed.
Corrupt value: 0x2ffffffe00000000
URLSessionBackportTest(26678,0x70000a1da000) malloc: *** set a breakpoint in malloc_error_break to debug
URLSessionBackportTest(26678,0x70000a1da000) malloc: Incorrect checksum for freed object 0x7fe7d9905d18: probably modified after being freed.
Corrupt value: 0x2ffffffe00000000
CoreSimulator 802.6.1 - Device: iPhone 8 Plus (250B5764-5BFD-440B-A918-82B557B5A993) - Runtime: iOS 14.5 (18E182) - DeviceType: iPhone 8 Plus
(lldb) 

Screenshot 2022-06-20 at 21 36 29

Third example

Screenshot 2022-06-20 at 21 37 59

I have also created a test repository which loads some image and also contains the kind of code I use the library with: https://github.com/alexanderwe/URLSessionBackportTest

Any help with that is highly appreciated !

Add Tests

Needs more tests to compare the esoteric cases to each other. I'm thinking of duplicating many of the tests with non-backported implementations, so if something nitty gritty changes (URL Session changes the order in which delegate methods are called, for instance), we can catch them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.