teradatasql: runtime/cgo: could not obtain pthread_keys

Edit: This is fixed. I was finally able to get their support and engineering team to reproduce the issue. They now build the driver with a newer version of go. Upgrade to >= 17.0.3, and you shouldn't see anymore segfaults.

I think I finally figured out why this happens. According to this Go issue, it happens if "If the host process spawns threads prior to loading the shared library, the offset will have changed."

In my case, I was importing matplotlib.pyplot in IPython before calling code that loads the shared library. This starts an event loop and causes the conditions that lead to the segfault.

I changed my code to import matplotlib.pyplot after configuring the teradata driver, and it went away.

According to the Go issue, they just need to recompile the library with a newer version of Go, which I've asked them to do. We'll see what they say.