Skip to content

Commit

Permalink
[eclipse-iceoryx#396] Fix linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Ziad Mostafa <[email protected]>
  • Loading branch information
zmostafa committed Nov 8, 2024
1 parent 890e941 commit dbf9096
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 50 deletions.
81 changes: 40 additions & 41 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

iceoryx2 stores all data in shared memory, which imposes certain restrictions.
Only data that is self-contained and does not use pointers to reference itself
is allowed. This is because shared memory is mapped at different offsets in
each process, rendering absolute pointers invalid. Additionally, if the data
is allowed. This is because shared memory is mapped at different offsets in each
process, rendering absolute pointers invalid. Additionally, if the data
structure uses the heap, it is stored locally within a process and cannot be
accessed by other processes. As a result, data types such as `String`, `Vec`,
or `HashMap` cannot be used as payload types.
accessed by other processes. As a result, data types such as `String`, `Vec`, or
`HashMap` cannot be used as payload types.

Additionally, every data type must be annotated with `#[repr(C)]`. The Rust
compiler may reorder the members of a struct, which can lead to undefined
behavior if another process expects a different ordering.

To address this, iceoryx2 provides shared-memory-compatible data types. You
can refer to the [complex data types example](examples/rust/complex_data_types),
To address this, iceoryx2 provides shared-memory-compatible data types. You can
refer to the [complex data types example](examples/rust/complex_data_types),
which demonstrates the use of `FixedSizeByteString` and `FixedSizeVec`.

## How To Define Custom Data Types (Rust)
Expand Down Expand Up @@ -58,24 +58,22 @@ insufficient, a new publisher with a larger `max_slice_len` can be created.

<!-- markdownlint-disable -->

> [!IMPORTANT]
> Be aware that the history of the old publisher is lost when it is
> [!IMPORTANT] Be aware that the history of the old publisher is lost when it is
> removed.
> [!NOTE]
> We are also working on an API that does not require the user to
> [!NOTE] We are also working on an API that does not require the user to
> explicitly create a new publisher whenever the memory is insufficient. It
> would also solve the history issue.
<!-- markdownlint-enable -->

## How To Make 32-bit and 64-bit iceoryx2 Applications Interoperatable

This is currently not possible since we cannot guarantee to have the same
layout of the data structures in the shared memory. On 32-bit architectures
64-bit POD are aligned to a 4 byte boundary but to a 8 byte boundary on
64-bit architectures. Some additional work is required to make 32-bit and
64-bit applications interoperabel.
This is currently not possible since we cannot guarantee to have the same layout
of the data structures in the shared memory. On 32-bit architectures 64-bit POD
are aligned to a 4 byte boundary but to a 8 byte boundary on 64-bit
architectures. Some additional work is required to make 32-bit and 64-bit
applications interoperabel.

## My Transmission Type Is Too Large, Encounter Stack Overflow On Initialization

Expand All @@ -89,8 +87,8 @@ than the available stack size.
## 100% CPU Load When Using The WaitSet

The WaitSet wakes up whenever an attachment, such as a `Listener` or a `socket`,
has something to read. If you do not handle all notifications, for example,
with `Listener::try_wait_one()`, the WaitSet will wake up immediately again,
has something to read. If you do not handle all notifications, for example, with
`Listener::try_wait_one()`, the WaitSet will wake up immediately again,
potentially causing an infinite loop and resulting in 100% CPU usage.

## Does iceoryx2 Offer an Async API?
Expand Down Expand Up @@ -123,30 +121,30 @@ But you can also use a crate like [ctrlc](https://docs.rs/ctrlc/latest/ctrlc/).
## How to use `log` or `tracing` as default log backend

* **log**, add the feature flag `logger_log` to the dependency in `Cargo.toml`
```toml
iceoryx2 = { version = "0.1.0", features = ["logger_log"]}
```
```toml
iceoryx2 = { version = "0.1.0", features = ["logger_log"]}
```
* **tracing**, add the feature flag `logger_tracing` to the dependency in
`Cargo.toml`
```toml
iceoryx2 = { version = "0.1.0", features = ["logger_tracing"]}
```
```toml
iceoryx2 = { version = "0.1.0", features = ["logger_tracing"]}
```

## How to set the log level
## Supported log levels

iceoryx2 gets the logging level from either the code, or the environment variable `IOX2_LOG_LEVEL`
the developer can set this environment variable with one of the supported levels:
```Trace, Debug, Info, Warning, Error, Fatal```
iceoryx2 support different log levels
`Trace, Debug, Info, Warning, Error, Fatal`

`export IOX2_LOG_LEVEL=Trace`
## How to set the log level

or via `.cargo/config.toml`
iceoryx2 gets its default logging level from `.cargo/config.toml` , but this can
be over ridden by environment variable `IOX2_LOG_LEVEL` the developer can set
this environment variable with one of the supported levels.

> [!NOTE]
> Setting IOX2_LOG_LEVEL from terminal will take precedence over setting it
> from `.cargo/config.toml`.
`export IOX2_LOG_LEVEL=Trace`

Developers can also set the logging level from within the code:
Developers can also set the logging level from within the code which will take
precedence over the environment variable:

```rust
use iceoryx2::prelude::*
Expand All @@ -158,10 +156,10 @@ set_log_level(LogLevel::Trace);

## A crash leads to the failure `PublishSubscribeOpenError(UnableToOpenDynamicServiceInformation)`

When an application crashes, some resources may remain in the system and need
to be cleaned up. This issue is detected whenever a new iceoryx2 instance is
created, removed, or when someone opens the service that the crashed process
had previously opened. On the command line, you may see a message like this:
When an application crashes, some resources may remain in the system and need to
be cleaned up. This issue is detected whenever a new iceoryx2 instance is
created, removed, or when someone opens the service that the crashed process had
previously opened. On the command line, you may see a message like this:

```ascii
6 [W] "Node::<iceoryx2::service::ipc::Service>::cleanup_dead_nodes()"
Expand All @@ -171,9 +169,9 @@ had previously opened. On the command line, you may see a message like this:
```

However, for successful cleanup, the process attempting the cleanup must have
sufficient permissions to remove the stale resources of the dead process. If
the cleanup fails due to insufficient permissions, the process that attempted
the cleanup will continue without removing the resources.
sufficient permissions to remove the stale resources of the dead process. If the
cleanup fails due to insufficient permissions, the process that attempted the
cleanup will continue without removing the resources.

Generally, it is not necessary to manually clean up these resources, as other
processes should detect and handle the cleanup when creating or removing nodes,
Expand All @@ -183,6 +181,7 @@ Nevertheless, there are three different approaches to initiate stale resource
cleanup:

1. **Using the iceoryx2 API**:

```rust
Node::<ipc::Service>::list(Config::global_config(), |node_state| {
if let NodeState::<ipc::Service>::Dead(view) = node_state {
Expand All @@ -198,6 +197,6 @@ cleanup:
2. **Using the command line tool**: `iox2 node -h` (NOT YET IMPLEMENTED)

3. **Manual cleanup**: Stop all running services and remove all shared memory
files with the `iox2` prefix from:
files with the `iox2` prefix from:
* POSIX: `/dev/shm/`, `/tmp/iceoryx2`
* Windows: `c:\Temp\iceoryx2`
27 changes: 18 additions & 9 deletions doc/release-notes/iceoryx2-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
conflicts when merging.
-->

* Add Event-Multiplexer `WaitSet` [#390](https://github.com/eclipse-iceoryx/iceoryx2/issues/390)
* Add `PeriodicTimer` into POSIX building blocks [#425](https://github.com/eclipse-iceoryx/iceoryx2/issues/425)
* Developer permissions for resources [#460](https://github.com/eclipse-iceoryx/iceoryx2/issues/460)
* Add `--send-copy` flag to Benchmark to consider mem operations [#483](https://github.com/eclipse-iceoryx/iceoryx2/issues/483)
* Add Event-Multiplexer `WaitSet`
[#390](https://github.com/eclipse-iceoryx/iceoryx2/issues/390)
* Add `PeriodicTimer` into POSIX building blocks
[#425](https://github.com/eclipse-iceoryx/iceoryx2/issues/425)
* Developer permissions for resources
[#460](https://github.com/eclipse-iceoryx/iceoryx2/issues/460)
* Add `--send-copy` flag to Benchmark to consider mem operations
[#483](https://github.com/eclipse-iceoryx/iceoryx2/issues/483)

### Bugfixes

Expand All @@ -35,11 +39,16 @@
conflicts when merging.
-->

* Rename `NodeEvent` into `WaitEvent` [#390](https://github.com/eclipse-iceoryx/iceoryx2/issues/390)
* Bazel support for the Rust crates [#349](https://github.com/eclipse-iceoryx/iceoryx2/issues/349)
* Remove ACL dependency [#457](https://github.com/eclipse-iceoryx/iceoryx2/issues/457)
* Publish Subscribe Header contains number of elements contained in a `Sample` [#498](https://github.com/eclipse-iceoryx/iceoryx2/issues/498)
* Read LogLevel from environment variable [#396](https://github.com/eclipse-iceoryx/iceoryx2/issues/396)
* Rename `NodeEvent` into `WaitEvent`
[#390](https://github.com/eclipse-iceoryx/iceoryx2/issues/390)
* Bazel support for the Rust crates
[#349](https://github.com/eclipse-iceoryx/iceoryx2/issues/349)
* Remove ACL dependency
[#457](https://github.com/eclipse-iceoryx/iceoryx2/issues/457)
* Publish Subscribe Header contains number of elements contained in a `Sample`
[#498](https://github.com/eclipse-iceoryx/iceoryx2/issues/498)
* Read LogLevel from environment variable
[#396](https://github.com/eclipse-iceoryx/iceoryx2/issues/396)

### Workflow

Expand Down

0 comments on commit dbf9096

Please sign in to comment.