-
Notifications
You must be signed in to change notification settings - Fork 51
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
SimpleIon READ ERROR, 10 unit tests failed consistently. #249
Comments
One example repro:
Detailed traceback:
|
#250 mitigate this issue by building C extension utilizing ion-c 1.1.0. The commit should be reverted once this issue is solved. |
After some digging, and applying an ion-c fix that is about to be submitted, I was able to fix the single ion-python unit test (non-ion-tests unit tests). The ion-tests failures took some digging to figure out what was going on. I'm not sure yet why the change to ion-c v1.1.1 triggered these tests to break, but looking at the failures, this is what I found. I updated --- a/amazon/ion/ioncmodule.c
+++ b/amazon/ion/ioncmodule.c
@@ -1361,6 +1361,11 @@ iERR ion_read_file_stream_handler(struct _ion_user_stream *pstream) {
PyObject *py_buffer = PyObject_CallMethod(stream_handle->py_file, "read", "O", IONC_STREAM_BYTES_READ_SIZE);
if (py_buffer == NULL) {
+ printf("[ion_read_file_stream_handler] py_buffer == NULL, py_file: \n");
+ PyObject_Print(stream_handle->py_file, stdout, 0);
+ printf("\nException:\n");
+ PyObject_Print(PyErr_Occurred(), stdout, 0);
+ printf("\n");
pstream->limit = NULL;
FAILWITH(IERR_READ_ERROR);
} This resulted in the following output:
So, right from the start we're not able to read from the file because the underlying The thing to note here, is that the test data that we're trying to give to ion-c is known to be invalid UTF-8, and the reason for the test is to ensure the parser (ion-c in our case) identifies it as such. This led me to look at how the files were being opened, and I found the I believe not too long ago we discussed only supporting UTF-8, and I believe that was the consensus, but I'm not sure. I have a PR in the works to update the |
I spent more time looking into why the ion-c v1.1.1 release would have changed the behavior of the unit test. A bugfix that was included in v1.1.1 changed how user managed stream handlers were called and did not bubble up read errors. This resulted in a bug where an error reading from the handler would be detected as EOF but only after calling next, which resulted in The python decoder exception described above occurs with both v1.1.0 and v1.1.1, however prior to v1.1.1, if the stream handler returned an error on first call, it would result in With the v1.1.1 change, that initial error from I have a PR that I'll be submitting shortly for ion-c that addresses the very first bug fix (that addressed the non-ion-test unit test failure), along with an update to address the read error bug. That alone will fix the unit test failures, but I also have an ion-python PR that I'll submit to remove the use of text decoding when using the C extension. It would probably also be a good idea to check for exceptions after read attempts in the C extension. If an underlying IO exception occurs, it would be nice to make sure that gets bubbled to the user, rather than just an ion related exception. I might include that in the PR as well. |
There are some read issues when using the simpleion module.
Example failed CI/CD workflow - https://github.com/amazon-ion/ion-python/actions/runs/4410728439/jobs/7728500690
1 failed unit test within ion-python is:
9 failed tests from ion-tests are:
Took a look, the root seems to be the recent ion-c change. Need further investigation.
The text was updated successfully, but these errors were encountered: