This practically mirrors my experience wrapping and using the Linux kernel drm_scheduler in Rust. C APIs tend to have very poor documentation on pointer lifetime requirements, and then the only way to get it right is to look at some example written by the library author and try to do the same thing and hope they got it right…
At least I had source code for the C side in my case, but the lifetime issues were much more subtle too, so it was still very hard to track the bugs down. And just like in this case, it turned out other users of the shared code were also doing things “wrong” and it just worked by accident.
I greatly appreciate any writeup that gives real space (and talks about the real time spent on) ideas that didn’t end up working. Here’s another, very different, one, on a weird optimization problem. Like I dig a good candid and thoughtful post-incident write-up.
If you’ve worked enough time on real, messy problems, you have these stories. There’s sometimes valuable info at a detail level, and very often give important perspective in a more general way as well. But, like a negative scientific result too often doesn’t get published, they tend not to get talked about in favor of the successes.
This practically mirrors my experience wrapping and using the Linux kernel drm_scheduler in Rust. C APIs tend to have very poor documentation on pointer lifetime requirements, and then the only way to get it right is to look at some example written by the library author and try to do the same thing and hope they got it right…
At least I had source code for the C side in my case, but the lifetime issues were much more subtle too, so it was still very hard to track the bugs down. And just like in this case, it turned out other users of the shared code were also doing things “wrong” and it just worked by accident.
I wrote some more about my experience here:
I greatly appreciate any writeup that gives real space (and talks about the real time spent on) ideas that didn’t end up working. Here’s another, very different, one, on a weird optimization problem. Like I dig a good candid and thoughtful post-incident write-up.
If you’ve worked enough time on real, messy problems, you have these stories. There’s sometimes valuable info at a detail level, and very often give important perspective in a more general way as well. But, like a negative scientific result too often doesn’t get published, they tend not to get talked about in favor of the successes.