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

srt-file-transmit loses 99% of data in transfer #645

Closed
dnastrain opened this issue Apr 17, 2019 · 5 comments · Fixed by #658
Closed

srt-file-transmit loses 99% of data in transfer #645

dnastrain opened this issue Apr 17, 2019 · 5 comments · Fixed by #658
Labels
[apps] Area: Test applications related improvements Type: Bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@dnastrain
Copy link

dnastrain commented Apr 17, 2019

Issue seems to coincide with commit 9e48f03 about 6 days ago, that srt-file-transmit no longer works correctly.

Running both Source and Target sides with "-v" reveals data loss -- Source sending 1316 bytes per chunk sent, and the Target receiving 1 byte per chunk sent.

Source-side: sends a file size 134,232 bytes input3.txt

srt-file-transmit.exe -v ./input3.txt srt://:5555
SOURCE type=file, TARGET type=srt
Extract path './input3.txt': directory=C:\Users\dbalma\Projects\srt\bin\Release/. filename=input3.txt
Opening SRT target listener on :5555
Binding a server on :5555 ...
 listen...
Event with status 3

 accept...
 connected.
Target connected (listener)
Upload: 1316 --> 1316
Event with status 5

Upload: 1316 --> 1316
Event with status 5

Upload: 1316 --> 1316
Event with status 5

[...]

Upload: 1316 --> 1316
Event with status 5

File sent
Buffers flushed
SrtCommon: DESTROYING CONNECTION, closing sockets (rt%980186327 ls%-1)...
SrtCommon: ... done.

Target-side: receives file size 100 bytes output3.txt

srt-file-transmit.exe -v srt://127.0.0.1:5555 ./output3.txt
SOURCE type=srt, TARGET type=file
Extract path './output3.txt': directory=C:\Users\dbalma\Projects\srt\bin\Release/. filename=output3.txt
Opening SRT source caller on 127.0.0.1:5555
Connecting to 127.0.0.1:5555
Event with status 5

Source connected (caller), id []
Writing output to [C:\Users\dbalma\Projects\srt\bin\Release/./output3.txt]
Download: --> 1
Event with status 5

Download: --> 1
Event with status 5

Download: --> 1
Event with status 5

[...]

Download: --> 1
Event with status 6

Source disconnected
SrtCommon: DESTROYING CONNECTION, closing sockets (rt%120426075 ls%-1)...
SrtCommon: ... done.

@howlowck also observed this behavior -- we've reproduced on both Linux and Windows builds this week.

@dnastrain dnastrain changed the title srt-file-transmit.exe data lost in transfer srt-file-transmit.exe loses 99% of data in transfer Apr 18, 2019
@dnastrain dnastrain changed the title srt-file-transmit.exe loses 99% of data in transfer srt-file-transmit loses 99% of data in transfer Apr 18, 2019
@maxsharabayko maxsharabayko added this to the v.1.3.3 milestone Apr 18, 2019
@maxsharabayko maxsharabayko added [apps] Area: Test applications related improvements Type: Bug Indicates an unexpected problem or unintended behavior labels Apr 18, 2019
@maxsharabayko
Copy link
Collaborator

@dnastrain
Thanks for reporting.
The issue is with the return value of srt->Read(…). It actually returns true/false, while I was expecting it to return the number of bytes actually read (like srt_recv(s, buf.data(), ::g_buffer_size);, that was previously used instead. Issue introduced by PR #598.

n = src->Read(cfg.chunk_size, buf, out_stats);
if (n == SRT_ERROR)
{
	cerr << "Download: SRT error: " << srt_getlasterror_str() << endl;
	goto exit;
}

if (n == 0)
{
	result = true;
	cerr << "Download COMPLETE.";
	break;
}

maxsharabayko added a commit to maxsharabayko/srt that referenced this issue Apr 23, 2019
@rndi rndi closed this as completed in #658 Apr 23, 2019
rndi pushed a commit that referenced this issue Apr 23, 2019
* [apps] Fixed srt-file-transit (issue #645)
@zerodefect
Copy link
Contributor

Is there a way to catch problems like this in future using CI?

@maxsharabayko
Copy link
Collaborator

Cool question! :)
I am writing a python script that starts two subprocesses of srt-*-transmit, transmits generated data on a local host, and validates the data received. I hope it will work correctly in CI.

@maxsharabayko
Copy link
Collaborator

@zerodefect Drafted a PR #663. Feel free to contribute.

@zerodefect
Copy link
Contributor

Brilliant! Been on leave for a number of days, but this looks very promising and a welcome addition!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[apps] Area: Test applications related improvements Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants