This reworks the task locking and background worker shutdown logic.
Tasks are now refcounted so they can be executed concurrently while another thread removes them from the queue. In case the background worker can’t be cleanly shut down (due to slow network), the task queue is being dumped, but the background worker itself is not freed from the main thread, to avoid potential use-after-free bugs.
Also, the background worker itself is refcounted and owns its state.
The transport state is now owned by the background worker, and passed explicitly to the task send function. The task state itself was removed in favor of providing the envelope directly.
# Tests added:
* Object cloning and overwriting keys.
* Serializing more msgpack values.
* Forcing captured events to have a uuid event_id.
* JSON escapes and surrogate parsing, also fixing a bug for that.
* Discarding events when missing consent.
* Test and fix recording errors on current session.
* Sessions with username did.
* Lots of abnormal sessions on startup.
# Bugs fixed:
* Wrong JSON decoding with surrogate pairs.
* Memory Leak parsing unmatched surrogate pairs.
* Never recorded error counts on sessions.
* correct some issues found by clang-analyzer (dead stores, one of them a bug in the page allocator)
* fix other warnings on clang
* turn of warnings-as-errors on CI for clang and msvc
The inproc and breakpad backends will invoke the default transports dump method,
that method will first check that it is actually the transport responsible,
and will then dump all the envelopes in matching tasks.
The bg worker is changed in a way that it only pops tasks *after* they are completed.
That way, in case of a race, we end up with duplicate events rather than dropped events.
* tests: Move integration tests to use the example
fixes#138 (proper json serialization of unicode)
* move staticlib test from azure to pytest
* integration requirements was moved
* make ldd test properly run in python
* use an explicit values key for threads
* feat: implement a disk transport
… and enforce it inside the signal handler to write crashes to disk
* rename sentry__string_dup method per review
* introduce an internal MUST_USE macro