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

Error "expected 227171 bytes but received 227555" #40

Closed
j3soon opened this issue Sep 18, 2024 · 2 comments
Closed

Error "expected 227171 bytes but received 227555" #40

j3soon opened this issue Sep 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@j3soon
Copy link
Owner

j3soon commented Sep 18, 2024

-- Reported by @ijsun, using v0.2

Unsure how to reliably reproduce yet, may need a better logging mechanism as discussing in #17

@j3soon
Copy link
Owner Author

j3soon commented Oct 23, 2024

I think that this is due to the recording hasn't been completely stopped (therefore keep writing new audio) while sending the HTTP request, causing mismatch between the size look up and actual file size.

References:

@j3soon
Copy link
Owner Author

j3soon commented Oct 23, 2024

@ijsun shared that this can be somehow reliably reproduced by following the steps below:

  • While recording, switch back to Google Keyboard without stopping/cancelling.
  • Optionally use Google voice input to input some text.
  • Switch back to Whisper Input, and try to input some text.
  • Observe the error.

j3soon added a commit that referenced this issue Nov 7, 2024
I hypothesize that this is due to a potential race condition between two
recorders when the keyboard has been destroyed while recording. When the
keyboard has been recreated, it will start a second new recorder. Since
the first recorder isn't stopped, sending a request based on the file
may lead to mismatch between file header size and actual file size,
since the file is being written to while being read.

Full error message:

```
expected X bytes but received Y
```

Note that Y will be larger than X.

Fixes: #40
j3soon added a commit that referenced this issue Nov 7, 2024
I hypothesize that this is due to a potential race condition between two
recorders when the keyboard has been destroyed while recording. When the
keyboard has been recreated, it will start a second new recorder. Since
the first recorder isn't stopped, sending a request based on the file
may lead to mismatch between file header size and actual file size,
since the file is being written to while being read.

Full error message:

```
expected X bytes but received Y
```

Note that Y will be larger than X.

Fixes: #40
@j3soon j3soon added the bug Something isn't working label Nov 7, 2024
@j3soon j3soon closed this as completed in 0750576 Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant