Description
When the length of the sandbox parameters (sandboxparam) exceeds 255 characters, the question cannot be saved and an error message "Error writing to database" is shown. This issue commonly occurs with Java-type questions due to their longer file names or parameter lengths.
Expected Behavior:
Questions should be saved successfully regardless of the length of the sandbox parameters.
Actual Behavior:
An error "Error writing to database" appears when attempting to save questions with sandbox parameters longer than 255 characters.
Steps to Reproduce:
- Create a question of type java_class.
- In "support files" upload some jar files
- Enable "Customise"
- Under "Advanced customisation" set sandbox parameters with a length greater than 255 characters. E.g.
{"compileargs": ["-cp", "mylibrary-sample-3.12.3.jar:mylibrary-core-3.12.3.jar:mylibrary-databind-3.12.3.jar", "-J-Xss64m", "-J-Xmx4g"], "interpreterargs": ["-cp", ".:mylibrary-sample-3.12.3.jar:mylibrary-core-3.12.3.jar:mylibrary-databind-3.12.3.jar", "-Xss16m", "-Xmx500m"]}
- Attempt to save the question.
- Observe the error message.
Suggested Solution:
Increase the database field size for sandboxparam to accommodate longer sandbox parameter strings.
Workaround:
Shorten the file names of the jar files and in the sandbox parameters to stay within the current 255-character limit.