Commit Graph

48 Commits

Author SHA1 Message Date
1f3d76707d Fix Rubocop offenses 2023-12-26 01:58:46 +01:00
05adde58ce Correctly set current Sentry span for WebSocket requests 2023-12-02 23:30:03 +01:00
59aa3926d9 Fix misleading Sentry error for DockerContainerPool 2023-11-24 23:49:29 +01:00
e8619ae5f5 Add safeguard for sentry_span in connection.rb 2023-09-19 10:13:45 +02:00
56b6380f4d Capture invalid JSON received from runner management
Related to https://github.com/openHPI/codeocean/issues/1914
2023-09-19 10:13:45 +02:00
f47e29fae9 Fix missing sentry breadcrumb for websocket connection
It seems like we are still not setting the Sentry hub correctly. Therefore, we just use the hub passed with the span to add the breadcrumbs.
2023-09-08 00:01:20 +02:00
aaf1162cf8 Bump sentry-ruby and sentry-rails
Bumps [sentry-ruby](https://github.com/getsentry/sentry-ruby) and [sentry-rails](https://github.com/getsentry/sentry-ruby). These dependencies needed to be updated together.

Updates `sentry-ruby` from 5.10.0 to 5.11.0
- [Release notes](https://github.com/getsentry/sentry-ruby/releases)
- [Changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-ruby/compare/5.10.0...5.11.0)

Updates `sentry-rails` from 5.10.0 to 5.11.0
- [Release notes](https://github.com/getsentry/sentry-ruby/releases)
- [Changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-ruby/compare/5.10.0...5.11.0)

---
updated-dependencies:
- dependency-name: sentry-ruby
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: sentry-rails
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-07 14:16:10 +02:00
fd2d94568a Handle OutOfMemory runner errors with gVisor 2023-07-21 16:38:49 +02:00
c407d8cb8b Capture context for Sentry errors during WebSocket connection
Special handling is needed to ensure we have the transaction ID and Rack ENV. Otherwise the error cannot be matched to a transaction in Sentry. This special behavior is needed because of the underlying EventMachine, which executes code in a different thread/context.
2023-04-14 12:50:50 +02:00
e9cf79085a Refactor listing files to be independent of exiting runners
Previously, we were always fetching files, even if not required (e.g., for score runs). Now, we reduce the number of file listings and use a dedicated callback.
2023-02-16 10:50:01 +01:00
a558a6df3b Shorten message name for sentry hub cloning 2023-02-16 10:47:58 +01:00
91c2e14fe8 Fix error handling during Runner::Connection close
Closes CODEOCEAN-HQ
2023-02-16 10:47:28 +01:00
4a8653040c Use deep merge for Runner::Connection headers 2023-02-12 14:08:54 +01:00
b1372e880c Enable Sentry instrumentation for WebSocket connection 2023-02-12 13:51:10 +01:00
d50e6d30e9 List Files: Catch more Runner::Errors 2022-11-14 13:51:04 +01:00
60078701f5 Editor: Allow file retrieval after code run 2022-10-29 18:49:18 +02:00
66d4f90b4a Send the WebSocket message immediately with EventMachine.next_tick 2022-04-13 14:39:07 +02:00
c90e02e4f1 Fixes CODEOCEAN-5J with error during WebSocket handshake 2021-11-18 14:04:23 +01:00
eaa06ee528 DCP: Prevent double deletion of runner 2021-11-01 17:13:13 +01:00
dfdec92c6e Use ping option only for DCP WebSocket
* The Faye::WebSocket library will "buffer" some output of the connection and emit the `on :message` events in the order of the messages. However, when a ping is sent while the connection has already been closed, it will emit the `on :close` event immediately and drop all other messages (in that "buffer"). This is problematic for very short running executions that generate a long output (as this will be cut off without a proper exit message sent by Poseidon).
2021-11-01 17:13:11 +01:00
570809bfe9 Allow whitespace for JSON exit 2021-11-01 17:13:11 +01:00
6d1b388e3c Reorder methods in strategy classes 2021-11-01 17:13:07 +01:00
87c5302336 Switch logging to milliseconds and add more details
* By design, most logging happens in an `ensure` block. This ensures that no return value is modified unexpectedly.
2021-11-01 17:13:06 +01:00
e272fcd19c Add more comments and error logging to connection.rb 2021-11-01 17:13:04 +01:00
e95ad5e26c Add @!attribute comments to connection.rb 2021-11-01 17:13:04 +01:00
c7ddbd676c Do not forward custom exit handlers to frontend 2021-11-01 17:13:03 +01:00
50b62b5703 Move flush_buffers method in Runner::Connection 2021-11-01 17:13:03 +01:00
345860c779 Adapt output buffering to Poseidon and DCP
* Refactor flushing of messages
* Introduce two separate buffers for stdout and stderr
2021-11-01 17:13:00 +01:00
1891cdd69c Add check whether buffer is empty 2021-11-01 17:13:00 +01:00
58e923abd8 Add custom websocket header to strategy class 2021-11-01 17:12:59 +01:00
08f36a0a7a Destroy runner at management in case of errors 2021-11-01 17:12:59 +01:00
788f6dba20 Specify TLS certificate for Faye::WebSocket::Client 2021-11-01 17:12:59 +01:00
a074a5cb0d Add buffering to output received from runner 2021-11-01 17:12:58 +01:00
3240ea7076 Forward input as raw_event to runner
* Also, rename #send to #send_data in order to prevent debugging issues in RubyMine
2021-11-01 17:12:58 +01:00
0f92526494 Remove outdated output callback from Runner::Connection 2021-11-01 17:12:58 +01:00
cc98dc2229 Split WebSocket event in multiple lines before processing 2021-11-01 17:12:58 +01:00
6c5a5226b8 Preserve locale during Runner::Connections 2021-11-01 17:12:56 +01:00
325720bd3b Improve documentation in Runner::Connection 2021-11-01 17:12:56 +01:00
9e2cff7558 Attach connection errors to socket
Raising the errors would crash the current thread. As this thread
contains the Eventmachine, that would influence other connections
as well. Attaching the errors to the connection and reading them
after the connection was closed ensures that the thread stays
alive while handling the errors in the main thread of the current
request.
2021-11-01 17:12:53 +01:00
c7369366d5 Ensure that only one EventMachine is running 2021-11-01 17:12:52 +01:00
5cc180d0e9 Fix rubocop, I18n, cleanup rebase 2021-11-01 17:12:52 +01:00
36578a2817 Ensure to save Testrun even when an error occurs 2021-11-01 17:12:52 +01:00
5608d61b3a Replace metaprogramming in Runner::Connection
This prevents someone who is controlling the websocket connection
to send messages starting with 'handle_' to the connection object.
2021-11-01 17:12:51 +01:00
d1a5773e60 Add debug log statements to runner connection 2021-11-01 17:12:51 +01:00
704407b9fc Add strategy for DockerContainerPool
In order to provide an alternative to Poseidon, a strategy for the
DockerContainerPool is added that is used by the runner model.

Co-authored-by: Sebastian Serth <Sebastian.Serth@hpi.de>
2021-11-01 17:12:51 +01:00
413f9b2705 Improve error resilience and handling
Timeouts are now handled correctly and the Runner automatically
creates the execution environment if it could not be found in
Poseidon. The runner is deleted locally if Poseidon returns
a bad request error.
2021-11-01 17:12:50 +01:00
d5b274c9f2 Introduce new error types for runners
The errors are raised in the runner model and in the runner connection
class. In the submission controller the errors are rescued and,
depending on the error, the status timeout / container depleted is
sent to the client.
2021-11-01 17:12:48 +01:00
8d968e01e6 Move RunnerConnection into class Runner
The old approach was to require the runner connection. This did
not work anymore with Zeitwerk in Rails 6. @sebastian.serth and I
moved the Connection class in `lib` into the ActiveRecord class
`Runner`. This will also work with future changes like specific
error classes. Furthermore the config was fixed and simplified.

Co-authored-by: Sebastian Serth <Sebastian.Serth@hpi.de>
2021-11-01 17:12:47 +01:00