Skip to content

Conversation

@timmc-edx
Copy link
Contributor

We need to make globals JSON-friendly before sending them across the network.

Addresses edx/edx-arch-experiments#1016

We need to make globals JSON-friendly before sending them across the
network.

Addresses edx/edx-arch-experiments#1016
@timmc-edx
Copy link
Contributor Author

timmc-edx commented Apr 17, 2025

@MoisesGSalas Tagging you since this might be relevant to your deployment. I'd be curious if you've seen any of these errors. Here's a sample of what they look like (though the error message itself will differ if you're calling remote directly instead of calling it via darklaunch):

Apr 15 16:05:23 ip-XXXXX [service_variant=lms][xmodule.capa.safe_exec.safe_exec][env:prod-edx-edxapp] ERROR [ip-XXXXX  63040] [user XXXXX] [ip XXXXX] [safe_exec.py:233] - Error occurred while trying to remote exec in dark launch mode.
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/xmodule/capa/safe_exec/safe_exec.py", line 222, in safe_exec
    remote_emsg, _remote_exception = get_remote_exec(data)
                                     ^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/edx-platform/xmodule/capa/safe_exec/remote_exec.py", line 72, in get_remote_exec
    return remote_exec_function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/edx-platform/xmodule/capa/safe_exec/remote_exec.py", line 93, in send_safe_exec_request_v0
    payload = json.dumps(data)
              ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

We've seen very few of these, so they may be specific to some custom XBlock.

@timmc-edx timmc-edx merged commit 3a9b436 into master Apr 18, 2025
49 checks passed
@timmc-edx timmc-edx deleted the timmc/remote-json-safe branch April 18, 2025 15:22
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

tonybusa pushed a commit to tonybusa/edx-platform that referenced this pull request Apr 23, 2025
We need to make globals JSON-friendly before sending them across the
network.

Addresses edx/edx-arch-experiments#1016
@MoisesGSalas
Copy link

Hi @timmc-edx, sorry for the late response. I did a quick check on the instances that use codejail the most but none had any serialization errors.

@timmc-edx
Copy link
Contributor Author

Thanks for the update!

UsamaSadiq pushed a commit that referenced this pull request May 14, 2025
We need to make globals JSON-friendly before sending them across the
network.

Addresses edx/edx-arch-experiments#1016
marlonkeating pushed a commit that referenced this pull request Jul 15, 2025
We need to make globals JSON-friendly before sending them across the
network.

Addresses edx/edx-arch-experiments#1016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants