Closed
Bug 1072142
Opened 10 years ago
Closed 10 years ago
[woodduck] Read the 2nd socket message info directly
Categories
(Firefox OS Graveyard :: Bluetooth, defect, P1)
Tracking
(blocking-b2g:2.0M+, b2g-v2.0 unaffected, b2g-v2.0M fixed, b2g-v2.1 unaffected, b2g-v2.2 unaffected)
Tracking | Status | |
---|---|---|
b2g-v2.0 | --- | unaffected |
b2g-v2.0M | --- | fixed |
b2g-v2.1 | --- | unaffected |
b2g-v2.2 | --- | unaffected |
People
(Reporter: shawnjohnjr, Assigned: shawnjohnjr)
References
Details
(Whiteboard: [2.0M_only][blueangel])
Attachments
(1 file, 3 obsolete files)
The root cause is that we receive size=20 data directly, instead of receiving the 1st message (size=4) first then the 2nd message (size=16).
On AOSP or CAF platform, we received the message info separately, this is why we don't see this problem.
On woodduck, we received 20 bytes directly from stack, and sometimes we got 4 and 16 messages separately.
The result is inconsistent. Android is fine, because they read it from InputStream, but Gecko reads from libevent callback, whenever there is an incoming data.
Since this is no clean interface defined this behavior, I think we can handle inside Gecko.
Assignee | ||
Updated•10 years ago
|
OS: Linux → Gonk (Firefox OS)
Hardware: x86_64 → ARM
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → shuang
Assignee | ||
Updated•10 years ago
|
blocking-b2g: --- → 2.0M?
Assignee | ||
Comment 1•10 years ago
|
||
Assignee | ||
Comment 2•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8494459 -
Attachment description: bug1072142.patch → Bug 1072142 - [woodduck] Read the 2nd socket message info directly (v2.0M)
Assignee | ||
Updated•10 years ago
|
Attachment #8494466 -
Attachment description: Bug 1072142 - [woodduck] Read the 2nd socket message info directly → Bug 1072142 - [woodduck] Read the 2nd socket message info directly (master)
Assignee | ||
Updated•10 years ago
|
Attachment #8494459 -
Flags: review?(tzimmermann)
Assignee | ||
Updated•10 years ago
|
Attachment #8494466 -
Flags: review?(tzimmermann)
Assignee | ||
Updated•10 years ago
|
Attachment #8494459 -
Flags: feedback?(btian)
Assignee | ||
Updated•10 years ago
|
Attachment #8494466 -
Flags: feedback?(btian)
Comment 4•10 years ago
|
||
Comment on attachment 8494466 [details] [diff] [review]
Bug 1072142 - [woodduck] Read the 2nd socket message info directly (master)
Review of attachment 8494466 [details] [diff] [review]:
-----------------------------------------------------------------
r- for now, because I don't understand why the patch works. Shawn, can you give some more infos?
::: dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp
@@ +158,5 @@
> case MSG1_SIZE:
> status = RecvMsg2();
> break;
> + case TOTAL_MSG_SIZE:
> + status = RecvMsg2();
I don't understand this case. |mLen| is actually a misnomer, as it actually contains the current read offset in the buffer. That means we'd take this case after having processed 20 bytes already. Bu t |IsComplete| below should be true at 20 bytes, and we'd be stopping.
Attachment #8494466 -
Flags: review?(tzimmermann) → review-
Comment 5•10 years ago
|
||
Just a question for my understanding: on Woodduck, we receive one single message that includes 20 bytes of data + the file descriptor?
Updated•10 years ago
|
Whiteboard: [partner-blocker]
Assignee | ||
Updated•10 years ago
|
Attachment #8494466 -
Attachment is obsolete: true
Attachment #8494466 -
Flags: feedback?(btian)
Assignee | ||
Comment 6•10 years ago
|
||
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #4)
> Comment on attachment 8494466 [details] [diff] [review]
> Bug 1072142 - [woodduck] Read the 2nd socket message info directly (master)
>
> Review of attachment 8494466 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> r- for now, because I don't understand why the patch works. Shawn, can you
> give some more infos?
>
> ::: dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp
> @@ +158,5 @@
> > case MSG1_SIZE:
> > status = RecvMsg2();
> > break;
> > + case TOTAL_MSG_SIZE:
> > + status = RecvMsg2();
>
> I don't understand this case. |mLen| is actually a misnomer, as it actually
> contains the current read offset in the buffer. That means we'd take this
> case after having processed 20 bytes already. Bu t |IsComplete| below should
> be true at 20 bytes, and we'd be stopping.
Opps. It looks like my patch is wrong. Let me update it again.
Comment 7•10 years ago
|
||
I think a possible approach could be to fill the 20-byte buffer with each read and get the file descriptor. When the complete message has been read, continue by calling |Proceed|.
Assignee | ||
Comment 8•10 years ago
|
||
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #5)
> Just a question for my understanding: on Woodduck, we receive one single
> message that includes 20 bytes of data + the file descriptor?
Yes. On woodduck, the stack is different but follows BT HAL interface.
What I saw on woodduck is that we received 20 bytes of data directly.
Android read the 1st channel
http://androidxref.com/4.4.4_r1/xref/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java#320
Then wait for the 2nd message incoming, read 16 bytes
http://androidxref.com/4.4.4_r1/xref/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java#324
Android is fine and without any problem with this stack, because they read it from InputStream (which reads from buffer, but Gecko reads from libevent callback, whenever there is an incoming data.)
http://androidxref.com/4.4.4_r1/xref/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java#480
Comment 9•10 years ago
|
||
Comment on attachment 8494459 [details] [diff] [review]
Bug 1072142 - [woodduck] Read the 2nd socket message info directly (v2.0M)
Review of attachment 8494459 [details] [diff] [review]:
-----------------------------------------------------------------
f=me with comment addressed.
::: dom/bluetooth/bluedroid/BluetoothSocket.cpp
@@ +752,5 @@
> // If this is server socket, read header of next message for client fd
> mImpl->mReadMsgForClientFd = mIsServer;
> } else if (mReceivedSocketInfoLength == TOTAL_SOCKET_INFO_LENGTH) {
> + if (aMessage->mSize == TOTAL_SOCKET_INFO_LENGTH) {
> + // Some bluetooth stack might send total socket info length (20) directly
nit: revise comment as following:
// Some bluetooth stacks send socket info as a single
// 20-byte message so we read from last 16 bytes only.
@@ +754,5 @@
> } else if (mReceivedSocketInfoLength == TOTAL_SOCKET_INFO_LENGTH) {
> + if (aMessage->mSize == TOTAL_SOCKET_INFO_LENGTH) {
> + // Some bluetooth stack might send total socket info length (20) directly
> + // so we only need to read from the 2nd message
> + offset = 4;
offset = FIRST_SOCKET_INFO_MSG_LENGTH;
@@ +755,5 @@
> + if (aMessage->mSize == TOTAL_SOCKET_INFO_LENGTH) {
> + // Some bluetooth stack might send total socket info length (20) directly
> + // so we only need to read from the 2nd message
> + offset = 4;
> + }
nit: newline here.
Attachment #8494459 -
Flags: feedback?(btian) → feedback+
Assignee | ||
Updated•10 years ago
|
Attachment #8494459 -
Attachment is obsolete: true
Attachment #8494459 -
Flags: review?(tzimmermann)
Assignee | ||
Comment 10•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8495794 -
Flags: review?(tzimmermann)
Attachment #8495794 -
Flags: feedback+
Updated•10 years ago
|
Attachment #8495794 -
Flags: review?(tzimmermann) → review+
Assignee | ||
Updated•10 years ago
|
Attachment #8495794 -
Attachment is obsolete: true
Assignee | ||
Comment 11•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8495895 -
Attachment description: Bug 1072142 - [woodduck] Read the 2nd socket message info directly (v2.0M) → Bug 1072142 - [woodduck] Read the 2nd socket message info directly, r=tzimmermann, f=btian (v2.0M)
Assignee | ||
Comment 12•10 years ago
|
||
Assignee | ||
Comment 13•10 years ago
|
||
Since this patch is to fix the different behavior of blueangel stack and blocks so many test cases. I prefer to land on V2.0M first and let partner test further. I'm currently have some problems to make master codebase work on woodduck now.
Comment 14•10 years ago
|
||
Dear Shawn,
Really appreciate your help on this bug, i know you have put much effort fixing this. Since it blocks many test cases and partner is asking when can we fix this. Is it possible for you to give an ETA landing date?
Thank you very much!
Flags: needinfo?(shuang)
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 16•10 years ago
|
||
(In reply to Josh Cheng from comment #14)
> Dear Shawn,
>
> Really appreciate your help on this bug, i know you have put much effort
> fixing this. Since it blocks many test cases and partner is asking when can
> we fix this. Is it possible for you to give an ETA landing date?
>
> Thank you very much!
Already r+, so we need to wait for 2.0M sheriff merge this patch into 2.0M branch.
Comment 17•10 years ago
|
||
(In reply to Shawn Huang [:shawnjohnjr] from comment #16)
> (In reply to Josh Cheng from comment #14)
> > Dear Shawn,
> >
> > Really appreciate your help on this bug, i know you have put much effort
> > fixing this. Since it blocks many test cases and partner is asking when can
> > we fix this. Is it possible for you to give an ETA landing date?
> >
> > Thank you very much!
> Already r+, so we need to wait for 2.0M sheriff merge this patch into 2.0M
> branch.
Hi Shawn,
Understood! Thank you very much!
Comment 18•10 years ago
|
||
There will be another bug to follow this issue for master. Merge into 2.0m only.
http://hg.mozilla.org/releases/mozilla-b2g32_v2_0m/rev/ffb2fa8340f3
Status: NEW → RESOLVED
Closed: 10 years ago
status-b2g-v2.0M:
--- → fixed
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [partner-blocker] → [partner-blocker][2.0M_only]
Assignee | ||
Comment 19•10 years ago
|
||
Add tag in whiteboard to track specific platform dependency bug.
Whiteboard: [partner-blocker][2.0M_only] → [partner-blocker][2.0M_only][blueangel]
Updated•10 years ago
|
status-b2g-v2.1:
--- → unaffected
status-b2g-v2.2:
--- → unaffected
Target Milestone: --- → 2.1 S6 (10oct)
Updated•10 years ago
|
Blocks: Woodduck_Blocker
Updated•10 years ago
|
Whiteboard: [partner-blocker][2.0M_only][blueangel] → [2.0M_only][blueangel]
Updated•10 years ago
|
status-b2g-v2.0:
--- → affected
Updated•10 years ago
|
Updated•10 years ago
|
Blocks: Woodduck_P2
Updated•10 years ago
|
Priority: -- → P1
Updated•10 years ago
|
No longer blocks: Woodduck_P2
You need to log in
before you can comment on or make changes to this bug.
Description
•