cosmicds / hubbleds

Hubble's law data story
MIT License
0 stars 8 forks source link

Stage 4 infinite refresh error #618

Closed patudom closed 1 month ago

patudom commented 1 month ago

I first noticed this on #608, but it turns out it was a general issue on main.

From @nmearl: "My immediate suggestion is to check load_class_data.finished instead of load_class_data.value on line 136. This stops the infinite refresh for me."


What I did and observed:

Traceback (most recent call last):
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1707, in _render
    root_element = el.component.f(*el.args, **el.kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/pages/04-explore-data/__init__.py", line 80, in Page
    solara.lab.use_task(_load_student_data)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 846, in use_task
    return wrapper(f)
           ^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 840, in wrapper
    raise task_instance.exception
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 259, in runner
    self._last_value = value = await self.function(*args, **kwargs)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/pages/04-explore-data/__init__.py", line 78, in _load_student_data
    measurements = LOCAL_API.get_measurements(GLOBAL_STATE, LOCAL_STATE)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/remote.py", line 111, in get_measurements
    measurements.set(parsed_measurements)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 571, in set
    self._field.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 645, in set
    self._parent.set(parent_value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 620, in set
    self._parent.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 358, in set
    self._storage.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 266, in set
    self.fire(value, old)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 148, in fire
    with contextlib.ExitStack() as stack:
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/contextlib.py", line 601, in __exit__
    raise exc_details[1]
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/contextlib.py", line 586, in __exit__
    if cb(*exc_details):
       ^^^^^^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1194, in __exit__
    self._possible_rerender()
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1391, in _possible_rerender
    self.render(self.element, self.container)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1463, in render
    raise RuntimeError(msg)
RuntimeError: Too many renders triggered, your render loop does not stop
Last reason: Reason: state changed with key auto_subscribe_force_update_counter
Value changed from 61 to 62

Previous reasons: Reason: state changed with key auto_subscribe_force_update_counter
Value changed from 60 to 61

Originally posted by @patudom in https://github.com/cosmicds/hubbleds/issues/608#issuecomment-2359187105

patudom commented 1 month ago

I just tried making the suggested stage 4 changes locally, and I'm still stuck in an infinite loop.

@johnarban figured out that brand new students are not being added to classes, which we're guessing is contributing to these issues. @Carifio24 or @nmearl, can one of you please investigate this?

Terminal errors we are getting are:

[2024-09-23 16:46:50][    INFO][ STAGE 4]:Loading class data
INFO:STAGE 4:Loading class data
ERROR:    'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 259, in runner
    self._last_value = value = await self.function(*args, **kwargs)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/pages/04-explore-data/__init__.py", line 32, in load_class_data
    class_measurements = LOCAL_API.get_class_measurements(GLOBAL_STATE, LOCAL_STATE)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/remote.py", line 293, in get_class_measurements
    f"{global_state.value.student.id}/{global_state.value.classroom.class_info['id']}"
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
TypeError: 'NoneType' object is not subscriptable
ERROR:solara.task:'NoneType' object is not subscriptable
Carifio24 commented 1 month ago

Okay, it sounds like this might be a server-side issue. I'll investigate whether that's the case.

patudom commented 1 month ago

Thank you, @Carifio24! https://github.com/cosmicds/cosmicds/pull/337 is fixing this issue for me, so I will close it.