-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Node.js executor for DMOJ #1143
Conversation
Can one of the admins verify this patch? |
Your code looks fairly good, but I have to ask: what's the point of this? If you look at your submission for the A Plus B problem, you'll note that you are doing a lot of I/O boilerplate, mostly because node.js is designed for stream-based I/O and not so much for line-based I/O. You also won't be able to use The V8JS runtime is the exact same JS engine except it comes with a bunch of line-based I/O functions that requires a lot less boilerplate to use. |
Good point -- I think the main goal of this was for our engineers to run the code they submit locally on their machines without having to install the https://github.com/DMOJ/v8dmoj client locally, since Node.js is already preinstalled on their machines and is pretty widely used! It does require somewhat more boilerplate in code, though we often provide this with the problem. I'd understand if this is too different from the goals of the main DMOJ site though; let me know what might be helpful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some discussion, we've decided that Node.js is an okay addition after all.
dmoj/executors/NODEJS.py
Outdated
# Start syscalls copied from COFFEE.py | ||
'capget', | ||
'eventfd2', | ||
'newselect', | ||
'sched_yield', | ||
'select', | ||
'setrlimit', | ||
'statx', | ||
# End syscalls copied from COFFEE.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try trimming down this list? Also the comment is not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! I ran /judge/.docker/entry test | grep NODEJS
multiple times while commenting out these, and it seems like we only need capget
and eventfd2
. I left these two (and shutdown
) in.
@quantum5 Thanks again for the review and happy new year! I think I've addressed all comments; can you please take a look? Also, if you can check the associated PRs, that'd be great too: |
It looks like lint failed, but otherwise this looks good to me. Once you've resolved that, could you please rebase and squash your commits? After that we should be good to merge. |
I'm eagerly waiting for this PR to be merged as our community has also been asking for the ability to run JS code via Node.js for exactly the same reason @pxpeterxu mentioned. Please let me know if there is anything I can do to help get this merged ASAP 🙏 |
@int-y1 I fixed the lint errors! Hopefully this is ready to merge now, but let me know if there are any other changes (sorry, it's been a busy few weeks!) |
Thanks, could you please rebase and squash your commits into one? |
8c44618
to
7bfc8c0
Compare
Just done! Also, I didn't realize this project started at Don Mills C.I. -- I went there way back too! (Graduated 2010) |
Wow, small world! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #1143 +/- ##
==========================================
- Coverage 82.91% 82.14% -0.78%
==========================================
Files 141 142 +1
Lines 5373 5392 +19
==========================================
- Hits 4455 4429 -26
- Misses 918 963 +45 ☔ View full report in Codecov by Sentry. |
Looks like this failed CI because of
We should be able to just allow it, seems like it's part of some CFI protection in V8: |
I added a whitelist here, and it seems to be working: https://github.com/wanderlog/judge-server/actions/runs/7618060649 Force-pushed an update to this branch too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
not sure if this is the same problem than 5 day ago but i have got error today with dmoj-autoconf: Auto-configuring NODEJS: Protection fault on: 331 (sys_pkey_free) Adding 'pkey_free' to the white list do the tricks for me. |
Thanks for the report, I've put together #1164. |
Thanks again for maintaining DMOJ! It's a great project with a really solid security foundation.
Motivation
We wanted to use DMOJ for internal company events, and since our company's primary language is Javascript (using Node.js), we wanted to implement a version that used Node directly rather than using https://github.com/DMOJ/v8dmoj
This resolves issue #1136
Changes
Related PRs on other repositories
Testing
Deployed a judge server with this with the following Dockerfile:
Verified that test runs using this Dockerfile worked properly: