Merge lp://staging/~morphis/go-dbus/read-full-message into lp://staging/go-dbus/v1
Status: | Merged |
---|---|
Approved by: | John Lenton |
Approved revision: | 138 |
Merged at revision: | 137 |
Proposed branch: | lp://staging/~morphis/go-dbus/read-full-message |
Merge into: | lp://staging/go-dbus/v1 |
Diff against target: |
12 lines (+1/-1) 1 file modified
message.go (+1/-1) |
To merge this branch: | bzr merge lp://staging/~morphis/go-dbus/read-full-message |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John Lenton | Approve | ||
Konrad Zapałowicz (community) | code | Approve | |
Review via email: mp+317757@code.staging.launchpad.net |
Commit message
Continue to read until we have read the full message body
If message are huge the current code doesn't read the full message body but only as much as the read buffer on that platform can carry. To still read all available bytes for the message body we continue reading until we received all bytes and the message body is complete.
Description of the change
We discovered this problem with running ciborium on a system with a huge amount of mount entries (Ubuntu Core based) and ciborium simply refused to receive a full message it received from the udisks2 service with
Feb 20 10:54:17 caracalla systemd[1]: Started Service for snap application udisks2.ciborium.
Feb 20 10:54:17 caracalla snap[3871]: + sleep 3
Feb 20 10:54:20 caracalla snap[3871]: + exec /snap/udisks2/
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 main.go:126: Using system bus on :1.41
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 dispatcher.go:74: Creating new dispatcher.
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 dispatcher.go:61: Connecting to signal /org/freedeskto
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 main.go:143: Listening for addition and removal events.
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 main.go:159: Listening for mount and unmount events.
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 dispatcher.go:61: Connecting to signal /org/freedeskto
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 dispatcher.go:97: Init the dispatcher.
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 udisks2.go:414: emitExistingDevices
Feb 20 10:54:20 caracalla snap[3871]: 2017/02/20 10:54:20 dbus.go:170: Failed to read message: Could not read message body
Debugging showed that the number of bytes read from the connection are less than the number of bytes expected to receive the full body:
Body length: 59113
Bytes read: 36464
LGTM