Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Engine crashes when client sends nan or inf float to UI

Aperta Adatta ai principianti
#1,458 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Exudev ci sta già lavorando.

Dal 24/2/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Inizia in tracking/utils, in make_json_safe, e ispeziona il controllo di json.dumps descritto nell’issue. Riproduci il problema facendo restituire nan e inf al node mentre il tracking è abilitato, quindi verifica che la UI riceva questi valori come null senza che l’engine o il request worker si blocchi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug SDK

The requests JSON serializer defaults to not handling nan or inf floats and instead throws an exception that crashes the engine. The tracking/utils:make_json_safe function does not make objects safe enough to avoid this and doesn't detect it since the json.dumps check doesults to allowing nans.

Current behavior

Engine crashes if a node returns nan or inf floats.

Stack Traces

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.13.11_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.11_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mfornander/gitlab/dcsim/.venv/lib/python3.13/site-packages/hamilton_sdk/api/clients.py", line 236, in worker
    self.flush(batch)
    ~~~~~~~~~~^^^^^^^
  File "/Users/mfornander/gitlab/dcsim/.venv/lib/python3.13/site-packages/hamilton_sdk/api/clients.py", line 262, in flush
    response = requests.put(
        f"{self.base_url}/dag_runs_bulk?dag_run_id={dag_run_id}",
    ...<5 lines>...
        verify=self.verify,
    )
  File "/Users/mfornander/gitlab/dcsim/.venv/lib/python3.13/site-packages/requests/api.py", line 130, in put
    return request("put", url, data=data, **kwargs)
  File "/Users/mfornander/gitlab/dcsim/.venv/lib/python3.13/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mfornander/gitlab/dcsim/.venv/lib/python3.13/site-packages/requests/sessions.py", line 575, in request
    prep = self.prepare_request(req)
  File "/Users/mfornander/gitlab/dcsim/.venv/lib/python3.13/site-packages/requests/sessions.py", line 484, in prepare_request
    p.prepare(
    ~~~~~~~~~^
        method=request.method.upper(),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<10 lines>...
        hooks=merge_hooks(request.hooks, self.hooks),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/mfornander/gitlab/dcsim/.venv/lib/python3.13/site-packages/requests/models.py", line 370, in prepare
    self.prepare_body(data, files, json)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/Users/mfornander/gitlab/dcsim/.venv/lib/python3.13/site-packages/requests/models.py", line 512, in prepare_body
    raise InvalidJSONError(ve, request=self)
requests.exceptions.InvalidJSONError: Out of range float values are not JSON compliant

Screenshots

n/a

Steps to replicate behavior

Add this simple node, enable on tracking on a working UI server, and ask for the node's result.

def nan_inf() -> list[float]:
    return [1.0, float("nan"), float("inf")]

Library & System Information

Python 3.13
Hamilton 1.89

Expected behavior

Not crashing and showing nan and inf values as "null" in UI.

Additional context

I have a simple fix for your make_json_safe function. Let me know if you want a PR.

Lingua principale
Jupyter Notebook
Stelle
2.6k
Fork
221
Merge medio
2g 1m
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/hamilton

Tutte le issue di apache/hamilton

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.