Closed TaeHagen closed 3 weeks ago
Is there any place I can see the actual data being sent between dart/flutter so I can see any disparity.
Yes: The SseDeserializer
has field buffer
, and that ReadBuffer
has field data
, and that ByteData
is the serialized bytes that is sent from Rust to Dart when you are using SSE codec. Thus printing that ByteData byte by byte may help (e.g. like you mentioned - see whether there is any difference in the bytes printed between debug and profile/release).
Also feel free to provide a minimal reproducible sample, s.t. I can reproduce locally and examine it.
So I did a bit of debugging, I'm going to look at the rust side now. I got a window of 60 bytes with the bad value at the center: Prod: 6261636b67726f756e645f636f6c6f725f32373278393264702e706e67010073ba84010100000005000000246e756c6c2200000068747470733a2f2f
Debug: 6261636b67726f756e645f636f6c6f725f32373278393264702e706e670100000000010100000005000000246e756c6c2200000068747470733a2f2f
As you can see, they are identical except the 8 bytes in the middle. If you have any tips about rust side would be appreciated.
WOAH, the corruption is apparently there on the rust side???? 67726f756e645f636f6c6f725f32373278393264702e706e67010073ba84
Okay i fixed it. Firstly, rust's optimizations are incredible, they converted the match into a direct memory copy i assume. I had mismatched #[repr(C)] and #[repr(rust)] and apparently #[repr(rust)] has a one byte enum marker or something I assume. I transmuted between them, failing to notice, causing UB.
It would be nice to have a way to call a rust lib directly without having to copy over headers and transmute. (if i just Pub, they're opaque which i can't have).
Thank you!
You are welcome!
It would be nice to have a way to call a rust lib directly without having to copy over headers and transmute.
Not very get it, could you please elaborate a bit more what you have done / want to do?
I have a rust library that does all the work. I would like to call it directly from flutter, but instead i must write rust functions that call library code. Worse, I need to access the library structures, so I am forced to copy over the structures and transmute between them so FRB can see them and generate code. It would be nice to have some solution to avoid having duplicate structures and issues like this one.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.
Describe the bug
In this specific case, I am getting this error only when building for Android on profile or prod (debug works fine). The serialization/deserialization code appears to be fine. Is there any place I can see the actual data being sent between dart/flutter so I can see any disparity.
The struct before has a version number that appears to be intact, so not sure why it would fail here.
The struct before has a version number that appears to be intact, so not sure why it would fail here.
Steps to reproduce
I really have no clue. This only happened in a specific part of my app
Logs
Expected behavior
It works fine
Generated binding code
OS
Linux
Version of
flutter_rust_bridge_codegen
1.1.0
Flutter info
No response
Version of
clang++
No response
Additional context
Thank you!