Skip to content

ZMQ write() fails with NumPy values — file path converts types but ZMQ path doesn’t #246

@Titas-Ghosh

Description

@Titas-Ghosh

Hi @pradeeban @mayureshkothare @Rahuljagwani ,
I think I found a runtime bug in the ZMQ path that’s easy to miss but breaks real workloads.

In concore.py , file‑based write() converts NumPy values to native Python types (convert_numpy_to_python()), but the ZMQ path sends the raw val directly into send_json_with_retry(). If val contains numpy.float64, numpy.int64, or arrays, JSON serialization fails and the message is never sent (you just get an “Unexpected error during ZMQ write” log).

This makes mixed studies or ZMQ‑only studies brittle whenever NumPy is involved (which is almost always in control loops).

Where

concore.py, write() function, ZMQ branch.

Steps to reproduce

Create a ZMQ‑based study or a simple script.
Call concore.write("port_name", "data", [np.float64(1.0), np.int64(2)]).
Observe the error log and missing message.

Expected

ZMQ writes should accept NumPy values the same way file‑based writes do.

Actual

ZMQ send_json fails to serialize NumPy types and the message is dropped.

Suggested fix

Apply convert_numpy_to_python() before send_json_with_retry() in the ZMQ path. This keeps ZMQ and file behavior consistent.

If this sounds reasonable, I’m happy to open a PR with a small regression test as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions