Bug 1046930

Summary: gnome-bluetooth can not send big file to Android phone
Product: [Fedora] Fedora Reporter: mshlyn <linlongzhou>
Component: bluezAssignee: Don Zickus <dzickus>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: dwmw2, dzickus, kalevlember, linlongzhou, marcel
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-29 13:51:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
obexd log in messages
none
wireshark capture of failed sending
none
patch at least support sending one big file none

Description mshlyn 2013-12-27 13:17:00 UTC
Created attachment 842319 [details]
obexd log in messages

Description of problem:
gnome-bluetooth fails to send large files to Android phone. Sending small files(<=10 K) is fine. Generally, sending process stops at the very beginning(about 10K~100K).

Version-Release number of selected component (if applicable):
bluez-5.12-1.fc20.i686
gnome-bluetooth-3.10.0-1.fc20.i686

How reproducible:
It is always reproducible.

Steps to Reproduce:
1. Pair Android phone and gnome-bluetooth.
2. Send file from gnome-bluetooth.
3.

Actual results:
Sending process starts but quickly stops at about 10K~100K

Expected results:
Successfully send file to Android phone.

Additional info:
Sending large file from windows 7 to the same android 7 is fine.

Comment 1 mshlyn 2013-12-27 13:22:02 UTC
Created attachment 842320 [details]
wireshark capture of failed sending

Wireshark capture of gnome-bluetooth sending process.

Comment 2 mshlyn 2013-12-27 14:04:56 UTC
---------------------
515 Dec 22 13:23:44 localhost obexd[1972]: gobex/gobex.c:incoming_data() rsp opcode 2
516 Dec 22 13:23:44 localhost obexd[1972]: gobex/gobex.c:g_obex_ref() ref 4
517 Dec 22 13:23:44 localhost obexd[1972]: gobex/gobex.c:g_obex_srm_active() yes
518 Dec 22 13:23:44 localhost obexd[1972]: gobex/gobex.c:g_obex_send_req() conn 1
519 Dec 22 13:23:44 localhost obexd[1972]: gobex/gobex.c:handle_response() final_rsp and empty pending_    req
520 Dec 22 13:23:44 localhost obexd[1972]: gobex/gobex.c:g_obex_unref() ref 3
521 Dec 22 13:23:44 localhost obexd[1972]: gobex/gobex.c:incoming_data() req opcode 16
522 Dec 22 13:23:44 localhost obexd[1972]: gobex/gobex.c:incoming_data() Unknown header offset for opco    de 0x10
---------------------
gobex/gobex.c:incoming_data() receives a Continue (opcode 0x10) packet and set obex->pending_req to NULL, 
gobex/gobex.c:write_data() sets obex->pending_req to a valid put packet(opcode 0x2).
At gobex/gobex.c line 515~522, incoming_data() receives 2 RSP_CONTINUE packets. The first packet set obex->pending_req to NULL. So the second RSP_CONTINUE is wrongly treated as request packet in gobex/gobex.c:incoming_data(). 

gobex/gobex.c:incoming_data()
-----------------------------
        if (obex->pending_req) {
                struct pending_pkt *p = obex->pending_req;
                opcode = g_obex_packet_get_operation(p->pkt, NULL);
                header_offset = rsp_header_offset(opcode);
        } else {
                opcode = obex->rx_last_op;
                /* Unexpected response -- fail silently */
                if (opcode > 0x1f && opcode != G_OBEX_OP_ABORT) {
                        obex->rx_data = 0;
                        return TRUE;
                }
                header_offset = req_header_offset(opcode);
        }
-----------------------------------

So, it seems that if obex is SRM enabled we may receive two RSP_CONTINUE without write_data() in between.
Thus, in handle_response() we should not set obex->pending_req to NULL if SRM is enabled.

gobex/gobex.c:handle_response()
-------------------------------------
static void handle_response(GObex *obex, GError *err, GObexPacket *rsp)
{
        struct pending_pkt *p = obex->pending_req;
        gboolean disconn = err ? TRUE : FALSE, final_rsp = TRUE;

        if (rsp != NULL)
                final_rsp = parse_response(obex, rsp);

        if (p->cancelled)
                err = g_error_new(G_OBEX_ERROR, G_OBEX_ERROR_CANCELLED,
                                        "The operation was cancelled");

        if (err)
                g_obex_debug(G_OBEX_DEBUG_ERROR, "%s", err->message);

        if (p->rsp_func) {
                p->rsp_func(obex, err, rsp, p->rsp_data);

                /* Check if user callback removed the request */
                if (p != obex->pending_req)
                        return;
        }

        if (p->cancelled)
                g_error_free(err);

        if (final_rsp) {
                pending_pkt_free(p);
                obex->pending_req = NULL;
        }

        if (!disconn && g_queue_get_length(obex->tx_queue) > 0)
                enable_tx(obex);
}
-------------------------------------

Comment 3 mshlyn 2013-12-27 14:50:58 UTC
Created attachment 842355 [details]
patch at least support sending one big file

This patch supports sending one complete big file, but obexd can not successfully disconnect.

Comment 4 Fedora End Of Life 2015-05-29 10:11:41 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2015-06-29 13:51:56 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.