Skip to content
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

Use of %synchronize-at unexpectedly rejected #1617

Closed
bbannier opened this issue Dec 12, 2023 · 4 comments · Fixed by #1619
Closed

Use of %synchronize-at unexpectedly rejected #1617

bbannier opened this issue Dec 12, 2023 · 4 comments · Fixed by #1619
Labels
Bug Something isn't working Priority High

Comments

@bbannier
Copy link
Member

One would expect that the following code can be used to specify a literal to synchronize on independently of usual lookahead parsing:

module sync;

public type PDUs = unit {
    : (PDU &synchronize)[];
    on %synced { confirm; }
};

type PDU = unit {
    %synchronize-at = b"\x00";
    : uint32;
};

We currently reject this code.

$ spicyc -j sync.spicy
[error] sync.spicy:10:7: &synchronize cannot be used on field, look-ahead contains non-literals
[error] spicyc: aborting after errors
@bbannier bbannier added the Bug Something isn't working label Dec 12, 2023
@bbannier
Copy link
Member Author

bbannier commented Dec 12, 2023

We currently do not seem to account for %synchronize-at being used on a unit which is used in a container with lookahead. Indeed, the only test case for %synchronize-at we have is for a unit directly containing a unit with %synchronize-at.

Since synchronizing on a message in a container of unspecified size (i.e., involving lookahead) is pretty much the most common case of synchronization for TCP this is definitely something we should fix.

bbannier added a commit that referenced this issue Dec 12, 2023
We previously would not detect `%synchronize-at` or `%synchronize-from`
attributes if the unit was not directly in a field, i.e., we mishandled
the common case of synchronizing on a unit in a list.

With this patch we now handle these attributes, regardless of how the
unit appears.

Closes #1617.
bbannier added a commit that referenced this issue Dec 12, 2023
We previously would not detect `%synchronize-at` or `%synchronize-from`
attributes if the unit was not directly in a field, i.e., we mishandled
the common case of synchronizing on a unit in a list.

With this patch we now handle these attributes, regardless of how the
unit appears.

Closes #1617.
bbannier added a commit that referenced this issue Jan 11, 2024
We previously would not detect `%synchronize-at` or `%synchronize-from`
attributes if the unit was not directly in a field, i.e., we mishandled
the common case of synchronizing on a unit in a list.

With this patch we now handle these attributes, regardless of how the
unit appears.

Closes #1617.

(cherry picked from commit 57debb2)
@bbannier
Copy link
Member Author

Also backported to release/1.8.

@pauldokas
Copy link

Is there any chance of getting this fix into the 1.9 branch? Possibly in a 1.9.1 release?

bbannier added a commit that referenced this issue Feb 8, 2024
We previously would not detect `%synchronize-at` or `%synchronize-from`
attributes if the unit was not directly in a field, i.e., we mishandled
the common case of synchronizing on a unit in a list.

With this patch we now handle these attributes, regardless of how the
unit appears.

Closes #1617.

(cherry picked from commit 57debb2)
@bbannier
Copy link
Member Author

bbannier commented Feb 8, 2024

Backported to release/1.9.

@pauldokas Since I had already backported this to release/1.8 I now backported it to release/1.9 for consistency as well.

Please note that we typically only backport patches which fix incorrect runtime behavior (e.g., types showing incorrect behavior at runtime; grammar accepted, but incorrect parser generated). The issue fixed here does not fall under this since it is about adding to an incomplete feature (unintentionally incomplete and inconsistent with e.g., the docs, but not effect on runtime behavior). Backporting to release/1.8 was already outside of what we usually consider. If you have a general interest in such kind of fixes in the future it would be best to instead use the latest release, or alternatively cherry-pick changes of interest to you into a fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Priority High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants