I want to see the QA process that catch this bug!
When we get bug reports from the field, we routinely also do a small assessment to figure out why we missed the issue in our own internal tests and runway to production.
We just got a bug report like that. RavenDB is not usable at all on a Raspberry PI because of an error about Non ASCII usage.
This is strange. To start with we test on Raspberry Pi. To be rather more exact, we test on the same hardware and software combination that the user was running on. And what is this Non ASCII stuff? We don’t have any such thing in our code.
As we investigated, we figured out that the root cause was that we were trying to pass a Non ASCII value to the headers of the request. That didn’t make sense, the only things we write to the request in this case is well defined values, such as numbers and constant strings. All of which should be in ASCII. What was going on?
After a while, the mystery cleared. In order to reproduced this bug, you needed to have the following preconditions:
- A file hashed to a negative Int64 value.
- A system whose culture settings was set to sv-SE (Swedish).
- Run on Linux.
This is detailed in this issue. On Linux (and not on Windows), when using Swedish culture, negative numbers are using: ”−1” and not “-1”.
For those of you with sharp eyes, you noticed that this is U+2212, (minus sign), and not U+002D (hyphen minus). On Linux, for Unicode knows what, this is used as the negative mark. I would complain, but my native language has „.
Anyway, the fix was to force the usage of invariant when converting the Int64 to a string for the header, which is pretty obvious. We are also exploring how to fix this in a more global manner.
But I keep coming back to the set of preconditions that is required. Sometimes I wonder why we miss a bug, in this case, I can only say that I would have been surprised if we would have found it.
Comments
Does Your Code Pass The Turkey Test? http://www.moserware.com/2008/02/does-your-code-pass-turkey-test.html
😉
Elasticsearch's test suite runs in a randomly-chosen timezone and locale, which has caught some interesting things like this in the past. In the past year it's picked up at least a Turkish 'i' problem in a third-party library (https://issues.shibboleth.net/jira/browse/OSJ-224) and an issue with Newfoundland's timezone (https://github.com/elastic/elasticsearch/issues/27966).
David, That is very cool
I would worry more about the implementation as it is a code smell.
Comment preview