Closed Bug 1717185 Opened 3 years ago Closed 3 years ago

TCPSocket.send incorrectly returns true because mBufferedAmount is not updated in time

Categories

(Core :: DOM: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox89 --- wontfix
firefox90 --- wontfix
firefox91 --- fixed

People

(Reporter: rnons, Assigned: rnons)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [necko-triaged])

Attachments

(1 file)

The doc says

If send returns true, then less than 64k has been buffered and it's safe to immediately write more.

But if I keep sending, send always return true. Will send a patch soon.

Blocks: 1717160

Previously, mBufferedAmount is only updated when copy complete. If I keep calling send, NotifyCopyComplete is only called after the last send.

This patch changes to update mBufferedAmount in every send call, so that it returns false correctly if buffer is full.

Assignee: nobody → remotenonsense
Status: NEW → ASSIGNED
Component: DOM: Core & HTML → DOM: Networking
Severity: -- → S4
Priority: -- → P2
Whiteboard: [necko-triaged]
Attachment #9227841 - Attachment description: Bug 1717185 - Fix mBufferedAmount and return value of send in TCPSocket. r=valentin → WIP: Bug 1717185 - Fix mBufferedAmount and return value of send in TCPSocket.
Attachment #9227841 - Attachment description: WIP: Bug 1717185 - Fix mBufferedAmount and return value of send in TCPSocket. → Bug 1717185 - Fix mBufferedAmount and return value of send in TCPSocket.
Pushed by remotenonsense@gmail.com: https://hg.mozilla.org/integration/autoland/rev/875cd4a49df6 Fix mBufferedAmount and return value of send in TCPSocket. r=valentin

Backed out for failures on test_tcpsocket_client_and_server_basics.html.

[task 2021-06-30T00:26:23.800Z] 00:26:23     INFO - GECKO(11124) | [Parent 6700, Main Thread] ###!!! ASSERTION: not initialized: 'mSource && mSink', file /builds/worker/checkouts/gecko/netwerk/base/nsAsyncStreamCopier.cpp:320
[task 2021-06-30T00:26:23.950Z] 00:26:23     INFO -  Initializing stack-fixing for the first stack frame, this may take a while...
[task 2021-06-30T00:26:33.931Z] 00:26:33     INFO - GECKO(11124) | #01: NS_DebugBreak(unsigned int, char const*, char const*, char const*, int) [xpcom/base/nsDebugImpl.cpp:431]
[task 2021-06-30T00:26:33.931Z] 00:26:33     INFO - GECKO(11124) | #02: nsAsyncStreamCopier::AsyncCopy(nsIRequestObserver*, nsISupports*) [netwerk/base/nsAsyncStreamCopier.cpp:320]
[task 2021-06-30T00:26:33.932Z] 00:26:33     INFO - GECKO(11124) | #03: mozilla::dom::TCPSocket::EnsureCopying() [dom/network/TCPSocket.cpp:396]
[task 2021-06-30T00:26:33.933Z] 00:26:33     INFO - GECKO(11124) | #04: mozilla::dom::TCPSocket::NotifyCopyComplete(nsresult) [dom/network/TCPSocket.cpp:452]
[task 2021-06-30T00:26:33.933Z] 00:26:33     INFO - GECKO(11124) | #05: `anonymous namespace'::CopierCallbacks::OnStopRequest(nsIRequest*, nsresult) [dom/network/TCPSocket.cpp:343]
[task 2021-06-30T00:26:33.937Z] 00:26:33     INFO - GECKO(11124) | #06: mozilla::net::nsOnStopRequestEvent::Run() [netwerk/base/nsRequestObserverProxy.cpp:104]
[task 2021-06-30T00:26:33.939Z] 00:26:33     INFO - GECKO(11124) | #07: mozilla::RunnableTask::Run() [xpcom/threads/TaskController.cpp:503]
[task 2021-06-30T00:26:33.939Z] 00:26:33     INFO - GECKO(11124) | #08: mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex &> const&) [xpcom/threads/TaskController.cpp:805]
[task 2021-06-30T00:26:33.940Z] 00:26:33     INFO - GECKO(11124) | #09: mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex &> const&) [xpcom/threads/TaskController.cpp:641]
[task 2021-06-30T00:26:33.941Z] 00:26:33     INFO - GECKO(11124) | #10: mozilla::TaskController::ProcessPendingMTTask(bool) [xpcom/threads/TaskController.cpp:425]
[task 2021-06-30T00:26:33.942Z] 00:26:33     INFO - GECKO(11124) | #11: mozilla::detail::RunnableFunction<`lambda at /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:135:7'>::Run() [xpcom/threads/nsThreadUtils.h:533]
[task 2021-06-30T00:26:33.942Z] 00:26:33     INFO - GECKO(11124) | #12: nsThread::ProcessNextEvent(bool, bool*) [xpcom/threads/nsThread.cpp:1156]
[task 2021-06-30T00:26:33.943Z] 00:26:33     INFO - GECKO(11124) | #13: NS_ProcessNextEvent(nsIThread*, bool) [xpcom/threads/nsThreadUtils.cpp:466]
[task 2021-06-30T00:26:33.944Z] 00:26:33     INFO - GECKO(11124) | #14: mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) [ipc/glue/MessagePump.cpp:85]
[task 2021-06-30T00:26:33.945Z] 00:26:33     INFO - GECKO(11124) | #15: MessageLoop::RunInternal() [ipc/chromium/src/base/message_loop.cc:331]
[task 2021-06-30T00:26:33.945Z] 00:26:33     INFO - GECKO(11124) | #16: MessageLoop::RunHandler() [ipc/chromium/src/base/message_loop.cc:325]
[task 2021-06-30T00:26:33.946Z] 00:26:33     INFO - GECKO(11124) | #17: MessageLoop::Run() [ipc/chromium/src/base/message_loop.cc:307]
[task 2021-06-30T00:26:33.946Z] 00:26:33     INFO - GECKO(11124) | #18: nsBaseAppShell::Run() [widget/nsBaseAppShell.cpp:139]
[task 2021-06-30T00:26:33.947Z] 00:26:33     INFO - GECKO(11124) | #19: nsAppShell::Run() [widget/windows/nsAppShell.cpp:603]
[task 2021-06-30T00:26:33.947Z] 00:26:33     INFO - GECKO(11124) | #20: nsAppStartup::Run() [toolkit/components/startup/nsAppStartup.cpp:274]
[task 2021-06-30T00:26:33.948Z] 00:26:33     INFO - GECKO(11124) | #21: XREMain::XRE_mainRun() [toolkit/xre/nsAppRunner.cpp:5254]
[task 2021-06-30T00:26:33.949Z] 00:26:33     INFO - GECKO(11124) | #22: XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) [toolkit/xre/nsAppRunner.cpp:5452]
[task 2021-06-30T00:26:33.949Z] 00:26:33     INFO - GECKO(11124) | #23: XRE_main(int, char**, mozilla::BootstrapConfig const&) [toolkit/xre/nsAppRunner.cpp:5511]
[task 2021-06-30T00:26:33.950Z] 00:26:33     INFO - GECKO(11124) | #24: mozilla::BootstrapImpl::XRE_main(int, char**, mozilla::BootstrapConfig const&) [toolkit/xre/Bootstrap.cpp:45]
[task 2021-06-30T00:26:34.008Z] 00:26:34     INFO - GECKO(11124) | #25: NS_internal_main(int, char**, char**) [browser/app/nsBrowserApp.cpp:378]
[task 2021-06-30T00:26:34.008Z] 00:26:34     INFO - GECKO(11124) | #26: wmain(int, wchar_t**) [toolkit/xre/nsWindowsWMain.cpp:131]
[task 2021-06-30T00:26:34.009Z] 00:26:34     INFO - GECKO(11124) | #27: __scrt_common_main_seh() [/builds/worker/workspace/obj-build/browser/app/f:/dd/vctools/crt/vcstartup/src/startup/exe_common.inl:288]
[task 2021-06-30T00:26:34.012Z] 00:26:34     INFO -  fix-stacks: error: failed to read debug info file `wkernel32.pdb` for `C:\Windows\System32\KERNEL32.DLL`
[task 2021-06-30T00:26:34.013Z] 00:26:34     INFO -  fix-stacks: note: this is expected and harmless for all PDB files on opt automation runs
[task 2021-06-30T00:26:34.013Z] 00:26:34     INFO -  fix-stacks: The system cannot find the file specified. (os error 2)
[task 2021-06-30T00:26:34.013Z] 00:26:34     INFO - GECKO(11124) | #28: BaseThreadInitThunk [C:\Windows\System32\KERNEL32.DLL + 0x18484]
[task 2021-06-30T00:26:34.020Z] 00:26:34     INFO -  fix-stacks: error: failed to read debug info file `wntdll.pdb` for `C:\Windows\SYSTEM32\ntdll.dll`
[task 2021-06-30T00:26:34.021Z] 00:26:34     INFO -  fix-stacks: note: this is expected and harmless for all PDB files on opt automation runs
[task 2021-06-30T00:26:34.021Z] 00:26:34     INFO -  fix-stacks: The system cannot find the file specified. (os error 2)
[task 2021-06-30T00:26:34.021Z] 00:26:34     INFO - GECKO(11124) | #29: RtlValidSecurityDescriptor [C:\Windows\SYSTEM32\ntdll.dll + 0x6305a]
[task 2021-06-30T00:26:34.022Z] 00:26:34     INFO - GECKO(11124) | #30: RtlValidSecurityDescriptor [C:\Windows\SYSTEM32\ntdll.dll + 0x6302a]
[task 2021-06-30T00:26:34.022Z] 00:26:34     INFO - GECKO(11124) | (server event: data length: 65539)
[task 2021-06-30T00:26:34.022Z] 00:26:34     INFO - GECKO(11124) | (server event: close)
[task 2021-06-30T00:26:34.023Z] 00:26:34     INFO - GECKO(11124) | (client waiting for event)
[task 2021-06-30T00:26:34.023Z] 00:26:34     INFO - GECKO(11124) | (client event: error)
[task 2021-06-30T00:26:34.024Z] 00:26:34     INFO - GECKO(11124) | MEMORY STAT | vsize 1308MB | vsizeMaxContiguous 1293MB | residentFast 418MB | heapAllocated 178MB
[task 2021-06-30T00:26:34.024Z] 00:26:34     INFO - GECKO(11124) | (client event: close)
[task 2021-06-30T00:26:34.024Z] 00:26:34     INFO - TEST-OK | dom/network/tests/test_tcpsocket_client_and_server_basics.html | took 2400ms
[task 2021-06-30T00:26:34.025Z] 00:26:34     INFO - GECKO(11124) | [Parent 6700, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/chrome/nsChromeRegistry.cpp:180
[task 2021-06-30T00:26:34.025Z] 00:26:34     INFO - GECKO(11124) | [Parent 6700, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/dom/security/nsCSPService.cpp:191
[task 2021-06-30T00:26:34.026Z] 00:26:34     INFO - GECKO(11124) | [Parent 6700, Main Thread] WARNING: Failed to retarget HTML data delivery to the parser thread.: file /builds/worker/checkouts/gecko/parser/html/nsHtml5StreamParser.cpp:1371
[task 2021-06-30T00:26:34.026Z] 00:26:34     INFO - TEST-UNEXPECTED-FAIL | dom/network/tests/test_tcpsocket_client_and_server_basics.html | assertion count 1 is more than expected 0 assertions
Flags: needinfo?(remotenonsense)
Attachment #9227841 - Attachment description: Bug 1717185 - Fix mBufferedAmount and return value of send in TCPSocket. → Bug 1717185 - Fix mBufferedAmount and return value of send in TCPSocket. r=valentin
Pushed by remotenonsense@gmail.com: https://hg.mozilla.org/integration/autoland/rev/7b43d8647aa4 Fix mBufferedAmount and return value of send in TCPSocket. r=valentin
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Flags: needinfo?(remotenonsense)
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: