-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[24.1] Increase API robustness to invalid requests, improve compressed data serving #18494
Merged
mvdbeek
merged 4 commits into
galaxyproject:release_24.1
from
mvdbeek:fix_invalid_id_error_message
Jul 5, 2024
Merged
[24.1] Increase API robustness to invalid requests, improve compressed data serving #18494
mvdbeek
merged 4 commits into
galaxyproject:release_24.1
from
mvdbeek:fix_invalid_id_error_message
Jul 5, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I suspect a state bug in the tool form code is the issue here and the id refers to a HDA id, but this is a solid fix anyway if someone submits wrong values via the API. Fixes galaxyproject#18485: ``` Stack Trace Newest AssertionError: null File "galaxy/web/framework/decorators.py", line 346, in decorator rval = func(self, trans, *args, **kwargs) File "galaxy/webapps/galaxy/api/tools.py", line 247, in build return tool.to_json(trans, kwd.get("inputs", kwd), history=history) File "galaxy/tools/__init__.py", line 2510, in to_json populate_state(request_context, self.inputs, params.__dict__, state_inputs, state_errors) File "galaxy/tools/parameters/__init__.py", line 412, in populate_state _populate_state_legacy( File "galaxy/tools/parameters/__init__.py", line 625, in _populate_state_legacy check_param(request_context, input, param_value, context, simple_errors=simple_errors) File "galaxy/tools/parameters/__init__.py", line 246, in check_param value = param.from_json(value, trans, param_values) File "galaxy/tools/parameters/basic.py", line 2132, in from_json value = self.to_python(value, trans.app) File "galaxy/tools/parameters/basic.py", line 1963, in to_python return history_item_dict_to_python(value["values"][0], app, self.name) File "galaxy/tools/parameters/basic.py", line 2799, in history_item_dict_to_python return src_id_to_item(sa_session=app.model.context, security=app.security, value=value) File "galaxy/tools/parameters/basic.py", line 2056, in src_id_to_item assert item ```
We were mostly doing this already. Also raises an exception in `text_data` if content is not decodable. Fixes https://sentry.galaxyproject.org/share/issue/b826c0be95a4424e8b1d63983255f23d/: ``` UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte File "galaxy/web/framework/middleware/error.py", line 167, in __call__ app_iter = self.application(environ, sr_checker) File "galaxy/web/framework/middleware/statsd.py", line 29, in __call__ req = self.application(environ, start_response) File "/cvmfs/main.galaxyproject.org/venv/lib/python3.11/site-packages/paste/httpexceptions.py", line 635, in __call__ return self.application(environ, start_response) File "galaxy/web/framework/base.py", line 174, in __call__ return self.handle_request(request_id, path_info, environ, start_response) File "galaxy/web/framework/base.py", line 263, in handle_request body = method(trans, **kwargs) File "galaxy/webapps/galaxy/controllers/dataset.py", line 152, in display display_data, headers = data.datatype.display_data( File "galaxy/datatypes/tabular.py", line 199, in display_data truncated_data=open(dataset.get_file_name()).read(max_peek_size), File "<frozen codecs>", line 322, in decode ```
Fixes https://sentry.galaxyproject.org/share/issue/e2c535d2d4904d438a0a1524c991bba4/: ``` UnicodeEncodeError: 'ascii' codec can't encode characters in position 14-16: ordinal not in range(128) File "galaxy/web/framework/middleware/error.py", line 167, in __call__ app_iter = self.application(environ, sr_checker) File "galaxy/web/framework/middleware/statsd.py", line 34, in __call__ self.galaxy_stasd_client.timing(page, dt) File "galaxy/web/statsd_client.py", line 35, in timing self.statsd_client.timing(infix + path, time) File "statsd/client/base.py", line 33, in timing self._send_stat(stat, '%0.6f|ms' % delta, rate) File "statsd/client/base.py", line 61, in _send_stat self._after(self._prepare(stat, value, rate)) File "statsd/client/base.py", line 76, in _after self._send(data) File "statsd/client/udp.py", line 42, in _send self._sock.sendto(data.encode('ascii'), self._addr) ```
mvdbeek
force-pushed
the
fix_invalid_id_error_message
branch
from
July 4, 2024 09:40
15774a0
to
92bfaa6
Compare
davelopez
approved these changes
Jul 5, 2024
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.
They look like solid fixes. Thank you!
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See the commits for descriptions
How to test the changes?
(Select all options that apply)
License