Skip to content

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

Closed

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.

Activity

  1. pradeeban commented on Feb 11, 2026

    @pradeeban
    Member

    @Titas-Ghosh sure, go ahead.

  2. Titas-Ghosh commented on Feb 11, 2026

    @Titas-Ghosh
    ContributorAuthor

    Thanks, @pradeeban Sir, I’ve opened the PR #256 It fixes ZMQ JSON serialization for NumPy types, adds a regression test, and keeps existing behavior intact. Full test suite passes (python -m pytest -v, 55 tests). I’d be grateful for your review and any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions