Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Achieving true zero-copy with Iceoryx (Shared Memory)

オープン
#294 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
numpy, python

調査の方向性

CameraImage_type の構築と writer.write(msg_instance) の経路から始め、提供された IDL を使って memoryview のケースを再現し、約 30 回の呼び出し後に発生する失敗を再現します。完了条件は、大きな画像メッセージがエンコーディングエラーなしに安定して publish され、zero-copy の動作が文書化されているか、実装によって制限されていることです。

索引モデルが issue の本文から書いたものです。

説明

Hi everyone, I've been trying to use this library with CycloneDDS and Iceoryx. I built both libraries from source and can verify everything works from examples & benchmarks.

However, I'm struggling to achieve true zero-copy for large messages (raw images; ~5 MiB/image, 24 Hz). This is my sample IDL:

module TestMessage {
    struct CameraImage {
        unsigned long width;
        unsigned long height;
        sequence<octet> image_data;
    };
};

Given a numpy array, I can use arr.to_bytes() to publish the message. However, it takes ~350 ms to do so:

msg_instance = CameraImage_type(
     width=arr.shape[1],
     height=arr.shape[0],
     image_data=arr.to_bytes()
)
self.writer.write(msg_instance)

Using np.ascontiguousarray() and memoryview, I can get it down to ~0.1 ms:

contiguous_arr = np.ascontiguousarray(image_np)
c_buffer = memoryview(contiguous_arr.data)

msg_instance = CameraImage_type(
    width=contiguous_arr.shape[1],
    height=contiguous_arr.shape[0],
    image_data=c_buffer
)
self.writer.write(msg_instance)

BUT it quickly fails (~30 calls) with this error:

Failed to encode member image_data, value is <memory at 0x72118cf35990>

I was guessing that Python garbage collection is not in tune with CycloneDDS & Iceoryx. So I tried keeping explicit references to the last 1000 references to both contiguous_arr and c_buffer in a collection.deque() - without success.

Is there another way of making this work?

Best
Fabian

主要言語
Python
スター
110
フォーク
68
平均マージ
3日 5時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eclipse-cyclonedds/cyclonedds-python のほかの issue

eclipse-cyclonedds/cyclonedds-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。