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

Panic when reading from a Sampling port destination #16

Closed
dadada opened this issue Dec 8, 2022 · 3 comments · Fixed by #15
Closed

Panic when reading from a Sampling port destination #16

dadada opened this issue Dec 8, 2022 · 3 comments · Fixed by #15

Comments

@dadada
Copy link
Collaborator

dadada commented Dec 8, 2022

I have a partition that runs a process that very frequently reads from a sampling port. After running the partition for some time, I reliably get a read from an empty file, which causes a panic. The panic is fixed in #15, but the error persists. This is from the execution of the partition (Echo) with the fix from #15 applied. Now it panics in apex-rs?

 ERROR Partition: Echo                              > PanicInfo {
 ERROR Partition: Echo                              >     payload: Any { .. },
 ERROR Partition: Echo                              >     message: Some(
 ERROR Partition: Echo                              >         called `Result::unwrap()` on an `Err` value: TypedError { err: Panic, source: failed to fill whole buffer
 ERROR Partition: Echo                              >
 ERROR Partition: Echo                              >         Stack backtrace:
 ERROR Partition: Echo                              >            0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
 ERROR Partition: Echo                              >            1: linux_apex_core::file::TempFile<T>::read
 ERROR Partition: Echo                              >            2: <S as apex_rs::apex::sampling::abstraction::ApexSamplingPortP4Ext>::sampling_port_receive_unchecked
 ERROR Partition: Echo                              >            3: <apex_rs::apex::sampling::abstraction::SamplingPortDestination<_,H> as echo::echo::RunableProcess>::run_process
 ERROR Partition: Echo                              >            4: echo::entry_point_aperiodic
 ERROR Partition: Echo                              >            5: apex_rs_linux::process::Process::start::{{closure}} },
 ERROR Partition: Echo                              >     ),
 ERROR Partition: Echo                              >     location: Location {
 ERROR Partition: Echo                              >         file: "/home/dadada/.cargo/git/checkouts/apex-linux-53d7a06a5cb9e565/cdc4225/partition/src/apex.rs",
 ERROR Partition: Echo                              >         line: 157,
 ERROR Partition: Echo                              >         col: 14,
 ERROR Partition: Echo                              >     },
 ERROR Partition: Echo                              >     can_unwind: true,
 ERROR Partition: Echo                              > }

@dadada
Copy link
Collaborator Author

dadada commented Dec 8, 2022

I've updated the fix in #15 so it does not panic somewhere else. Unless the partition unwraps the result, there should be no panic now. But the fact that the file backing the sampling port can be empty still worries me.

@dadada
Copy link
Collaborator Author

dadada commented Dec 8, 2022

Original panic info

 ERROR Partition: Echo                              > PanicInfo {
 ERROR Partition: Echo                              >     payload: Any { .. },
 ERROR Partition: Echo                              >     message: Some(
 ERROR Partition: Echo                              >         index out of bounds: the len is 0 but the index is 0,
 ERROR Partition: Echo                              >     ),
 ERROR Partition: Echo                              >     location: Location {
 ERROR Partition: Echo                              >         file: "/home/dadada/.cargo/git/checkouts/apex-linux-1bbea6f3d09316d7/2f69d2b/core/src/file.rs",
 ERROR Partition: Echo                              >         line: 96,
 ERROR Partition: Echo                              >         col: 21,
 ERROR Partition: Echo                              >     },
 ERROR Partition: Echo                              >     can_unwind: true,
 ERROR Partition: Echo 

@dadada
Copy link
Collaborator Author

dadada commented Dec 8, 2022

This might not be a read from an empty file, but a read from the end of the file. The cursor may be moved between the seek to 0 and the read.

@dadada dadada changed the title Read from empty file Panic when reading from a Sampling port destination Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant