-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resynchronizing on unit error when failure happens after the first field. #1847
Comments
Sorry, but this isn't really useful as a ticket because the scope is completely unclear. Spicy doesn't even have a notion of TCP ACKing; if anything, that's Zeek-side. I'm closing this, but feel free to reopen once it has been scoped down to something actionable. |
Part of the issue here is that when we try to resychronize on an exhausted view we propagate up an incorrect error ( For this snippet I would expect resynchronization to fail with the original error instead of running into an exception from an exhausted view when parsing checks for module foo;
public type X = unit {
: (Y &synchronize)[];
};
type Y = unit {
: b"FOO";
: bytes &size=1;
}; $ printf FOO | spicy-driver -d foo.spicy
[error] terminating with uncaught exception of type hilti::rt::InvalidIterator: view starts before available range (foo.spicy:7:10-10:1) |
Sort of unrelated, but Mohan and I poked around synchronization yesterday and accidentally discovered where this bug actually lies. It looks like if the field failure happens in the first field of the structure, then synchronization happens correctly, but if it happens in a field after that there is an error and recovery doesn't occur. It turns out that all of the gap tests only test the failure occurring in the first field of the unit. The best part is that we have a short and easy to understand reproducer script! This works fine...
with this spicy-driver batch file...
❯ spicy-driver -F test7.dat test7.spicy
Confirming with state: [$x=[]]
[$x=[[$ab=b"AB", $cd=b"CD"]]] but if we force the error to occur in the second field by letting the first field be fully populated (the first 'C' is missing) with this batch file we get the error...
❯ spicy-driver -F test7.dat test7.spicy
error for ID id1: view starts before available range (test7.spicy:9:5-9:29) Hopefully this is boiled down enough to pinpoint where the problem is. I tested this in several different ways and as far as I can tell the failures seem to be centered around where in the unit the errors are happening. It leads me to believe that some state in the stream is being mutated and not reset once fields have been successfully parsed and an error happens later in the unit structure (I'm also crossing my fingers that this means this bug might be easily fixed!) |
I've started to look into this, but no leads yet. |
According to git bisect I found the offending commit....
|
Right, see Benjamin's note above. |
Ugh, I totally missed that he pointed out the commit. Anyway, first time I've used git bisect and that was definitely worthwhile learning. |
* origin/topic/robin/gh-1847-resync-error: Fix resynchronization issue with trimmed input. Add missing printer support for exception values.
I think this bug was in 1.11, would it justify a 1.11.2? This bug does break most practical uses of synchronize. |
Will it be backported to Zeek v7.0.1? |
Yes, it will be in 1.11.2 and 7.0.2. |
When chunked data is read into a sink, the analyzer throws a violation if a TCP ACKed unseen segment is present. The violation is of the form
view starts before available range
. A reproducer has been shared privately with @bbannier.The text was updated successfully, but these errors were encountered: