Skip to content

Conversation

jb3
Copy link
Member

@jb3 jb3 commented Oct 9, 2025

Note

This does not change the version of Python used to run the snekbox API and
wrap around nsjail, just the versions that are available within the execution
environment.

This PR:

  • Removes Python 3.13t, adds Python 3.14t
  • Defaults snekbox to use 3.14 when no version is specified
  • Upgrades Python 3.13.5 to 3.13.8
  • Updates integration tests accordingly to reflect these changes
  • Upgrades all dependencies that are made available to users

@jb3 jb3 requested review from Den4200 and MarkKoz as code owners October 9, 2025 19:45
@jb3 jb3 changed the title --- Python (code eval) & dependency version upgrades Oct 9, 2025
@jb3 jb3 added area: dependencies Related to package dependencies and management status: needs review Author is waiting for someone to review and approve area: backend Related to internal functionality and utilities priority: 2 - normal labels Oct 9, 2025
@jb3 jb3 marked this pull request as draft October 9, 2025 20:46
@coveralls
Copy link

coveralls commented Oct 9, 2025

Coverage Status

coverage: 88.265%. remained the same
when pulling ad17dac on jb3/3.14t-and-deps
into a8d02e0 on main.

@jb3 jb3 force-pushed the jb3/3.14t-and-deps branch 4 times, most recently from e67219b to ebe1afe Compare October 9, 2025 21:56
jb3 added 4 commits October 9, 2025 23:04
Changes to multiprocessing in Python 3.14 make it more likely that the 5
PID limit is hit even with non-complicated uses of multiprocessing.

We have enough compute to allocate more PIDs and safely know this will
not affect the operation of other services (we have since migrated our
databases and heavier processing applications onto other hosts).
@jb3 jb3 force-pushed the jb3/3.14t-and-deps branch from ebe1afe to 94f61f6 Compare October 9, 2025 22:04
@jb3 jb3 marked this pull request as ready for review October 9, 2025 22:10
self.assertIn("Resource temporarily unavailable", result.stdout)
self.assertEqual(result.stderr, None)

self.nsjail.config.cgroup_pids_max = previous_pids_max
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in a finally block in case an assertion fails so other tests aren't impacted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amended in ad17dac

object = "A" * 40_000_000
time.sleep(0.5)
if __name__ == "__main__":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this added?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forkserver becoming the default start method means this is required (both forkserver and spawn will raise RuntimeError if the main module cannot be safely imported).

In 3.14, forkserver became the default for POSIX (Windows and macOS continue to use spawn), previously fork was used which did not require this.

https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

envar: "MKL_NUM_THREADS=5"
envar: "VECLIB_MAXIMUM_THREADS=5"
envar: "NUMEXPR_NUM_THREADS=5"
envar: "OMP_NUM_THREADS=15"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the increase?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind I read the commit message

This test case was being caught and nsjail was killing it, but not
because of PID exhaustion but memory exhaustion.

To ensure PID exhaustion is guarded against the PID count is now reduced
to a level where nsjail will kill the process earlier before the memory limit.
@jb3 jb3 force-pushed the jb3/3.14t-and-deps branch from 94f61f6 to ad17dac Compare October 10, 2025 16:50
@jb3 jb3 requested a review from MarkKoz October 10, 2025 16:55
jb3 added a commit to python-discord/bot that referenced this pull request Oct 10, 2025
See python-discord/snekbox#246 for relevant snekbox changes
@jb3 jb3 merged commit ad17dac into main Oct 11, 2025
6 of 7 checks passed
@jb3 jb3 deleted the jb3/3.14t-and-deps branch October 11, 2025 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: backend Related to internal functionality and utilities area: dependencies Related to package dependencies and management priority: 2 - normal status: needs review Author is waiting for someone to review and approve

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants