Skip to content
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

bug(common/models): Error in ModelCompositor.predict causes keyboard failure #5467

Closed
keyman-sentry bot opened this issue Jul 19, 2021 · 9 comments · Fixed by #5479
Closed

bug(common/models): Error in ModelCompositor.predict causes keyboard failure #5467

keyman-sentry bot opened this issue Jul 19, 2021 · 9 comments · Fixed by #5479

Comments

@keyman-sentry
Copy link

keyman-sentry bot commented Jul 19, 2021

Sentry Issue: KEYMAN-ANDROID-GS

Fatal keyboard error with obolo_chwerty:obolo_chwerty for  language. Loading default keyboard.

The breadcrumb shows:

packageID: obolo_chwerty
keyboardID: obolo_chwerty
keyboardType: SYSTEM
cm_message: Uncaught TypeError: Cannot read property 'sample' of undefined
cm_sourceID: blob:null/2eaf2e9d-75fc-490e-9426-446345506678
keyboardName: Obolo Chwerty
cm_lineNumber: 170

This was a little tricky to track down as we don't yet have good source visibility into the predictive text worker. I used the Chrome Web Inspector to view the blob in minified form, and there was only one reference to sample on line 170, which resolved to ModelCompositor.predict.

So, we appear to be getting an error in ModelCompositor.predict - perhaps an empty array or malformed data?

let inputTransform = transformDistribution.sort(function(a, b) {
return b.p - a.p;
})[0].sample;

Note that this error is occurring with various keyboards, including sil_euro_latin, and not just obolo_chwerty. I have linked related crash reports where I can find them.

@keyman-sentry
Copy link
Author

keyman-sentry bot commented Jul 19, 2021

Sentry issue: KEYMAN-WEB-11

@keyman-sentry
Copy link
Author

keyman-sentry bot commented Jul 19, 2021

Sentry issue: KEYMAN-ANDROID-11F

@keyman-sentry
Copy link
Author

keyman-sentry bot commented Jul 19, 2021

Sentry issue: KEYMAN-ANDROID-14Z

@keyman-sentry
Copy link
Author

keyman-sentry bot commented Jul 19, 2021

Sentry issue: KEYMAN-ANDROID-GS

@mcdurdin mcdurdin changed the title bug(common/predictive-text): Error in ModelCompositor.predict causes keyboard failure bug(common/models): Error in ModelCompositor.predict causes keyboard failure Jul 19, 2021
@mcdurdin mcdurdin added this to the A15S9 milestone Jul 19, 2021
@keyman-sentry
Copy link
Author

keyman-sentry bot commented Jul 19, 2021

Sentry issue: KEYMAN-ANDROID-14V

@keyman-sentry
Copy link
Author

keyman-sentry bot commented Jul 19, 2021

Sentry issue: KEYMAN-ANDROID-128

@keyman-sentry
Copy link
Author

keyman-sentry bot commented Jul 19, 2021

Sentry issue: KEYMAN-ANDROID-142

@keyman-sentry
Copy link
Author

keyman-sentry bot commented Jul 19, 2021

Sentry issue: KEYMAN-ANDROID-GS

@jahorton
Copy link
Contributor

jahorton commented Jul 22, 2021

Closest thing I can currently do for a repro: I built a temporary unit test for @keymanapp/input-processor to replicate the condition that could give rise to the error: an empty array of Alternates. The test case's code:

        let languageProcessor = new LanguageProcessor();
        languageProcessor.init();

        let contextSource = new com.keyman.text.Mock("li", 2);
        let transcription = contextSource.buildTranscriptionFrom(contextSource, null, null);
        // This should break things.
        transcription.alternates = [];

        languageProcessor.loadModel(modelSpec).then(function() {
          languageProcessor.predict(transcription).then(function(suggestions) {
            assert.isOk(suggestions);
            assert.equal(suggestions[0].displayAs, '«li»');
            assert.equal(suggestions[0].transform.insert, ' ');
            assert.equal(suggestions[1].displayAs, 'like');
            assert.equal(suggestions[1].transform.insert, 'like ');
            done();
          }).catch(done);
        }).catch(function() {
          assert.fail("Unexpected model load failure");
          done();
        });

The result:

image

Commenting out the line that "should break things" indeed unbreaks this temporary test case.

So, the remaining question is... what's causing an empty alternates array? That said... this could allow us to add 'breadcrumbs' of a sort outside of the worker, since it can be detected within KMW proper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants