I faced a strange thread-related segfault in libpq. in musl, I must add, because this may be a problem of glibc non-standard behavior that often is used in code and then programs fail on musl. I will run the test in glibc chroot too, just to get sure it's not a principal bug in the library code.
but for a while I cannot say where exactly it is. program fails in PQfnumber when another thread exists poll in PQgetResult. it happens not often, I tested my utility on high load requests traffic and at 40 000 requests per second it happens once in an hour or so. I'm sure that this should not happen because threads use thread local DB connections. but it does. the past night I caught 3 core dumps with the same segfault conditions and now have to debug PostgreSQL library to find out what the problem is. not that I'm too happy to do this but I have to.
#
programming #
postgresql #
c #
libpq #
bugs #
musl