google-code-export / red5

Automatically exported from code.google.com/p/red5
0 stars 0 forks source link

Record file broken with multithreading #430

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.Create a test application that inherit from MultiThreadedApplicationAdapter.
2.Add a custom "RecordingListener"(just echo data length in packetReceived 
method) to stream in  streamRecordStart handler.

3.Create about 30 connections to record at same time.
4.Stop record about 30 seconds later, and create a new connection to record 
again.

What is the expected output? What do you see instead?
I expected all .flv files will be saved to disk correctly, but the size of some 
.flv files are 0KB or 1KB, and I find some error messages in red5.log file.

What version of the product are you using? On what operating system?
Red5 1.0.2-SNAPSHOT / Windows 7 / 32Bit / Dual core 2.6GHz CPU / 3G RAM 

Please provide any additional information below.
red5 rtmp config:
2013-08-28 13:11:29,198 [main] INFO  o.r.s.net.rtmp.RTMPMinaTransport - RTMP 
Mina Transport bound to /0.0.0.0:1938
2013-08-28 13:11:29,199 [main] INFO  o.r.s.net.rtmp.RTMPMinaTransport - RTMP 
Mina Transport Settings
2013-08-28 13:11:29,200 [main] INFO  o.r.s.net.rtmp.RTMPMinaTransport - I/O 
Threads: 100
2013-08-28 13:11:29,309 [main] INFO  o.r.s.net.rtmp.RTMPMinaTransport - TCP No 
Delay: true
2013-08-28 13:11:29,309 [main] INFO  o.r.s.net.rtmp.RTMPMinaTransport - Traffic 
class modification is disabled
2013-08-28 13:11:29,310 [main] INFO  o.r.s.net.rtmp.RTMPMinaTransport - 
Settings - send buffer size: 1750000 recv buffer size: 65536 so linger: -1 
traffic class: 0

piece of red5.log:
2013-08-28 13:15:32,416 [NioProcessor-46] INFO  
o.r.s.net.rtmp.RTMPMinaIoHandler - Session opened: 45
2013-08-28 13:15:32,619 [NioProcessor-46] INFO  
o.r.s.n.r.codec.RTMPProtocolDecoder - Action connect
2013-08-28 13:15:32,625 [NioProcessor-46] INFO  test.Application - W3C 
x-category:session x-event:connect c-ip:192.168.62.186 c-client-id:44
2013-08-28 13:15:32,626 [NioProcessor-46] INFO  test.Application - 
appConnect...:RTMPMinaConnection from 192.168.62.186:41686 to 
192.168.62.141:1938 (in: 3494 out: 3073)
2013-08-28 13:15:32,695 [Red5_Scheduler_Worker-9] ERROR 
o.r.s.s.QuartzSchedulingServiceJob - Job 
org.red5.server.stream.RecordingListener$EventQueueJob@191a58f execution failed
java.lang.NullPointerException: null
    at org.red5.server.stream.consumer.FileConsumer.init(FileConsumer.java:403) ~[red5-server.jar:na]
    at org.red5.server.stream.consumer.FileConsumer.pushMessage(FileConsumer.java:228) ~[red5-server.jar:na]
    at org.red5.server.stream.RecordingListener.processQueue(RecordingListener.java:298) ~[red5-server.jar:na]
    at org.red5.server.stream.RecordingListener.access$2(RecordingListener.java:260) ~[red5-server.jar:na]
    at org.red5.server.stream.RecordingListener$EventQueueJob.execute(RecordingListener.java:356) ~[red5-server.jar:na]
    at org.red5.server.scheduling.QuartzSchedulingServiceJob.execute(QuartzSchedulingServiceJob.java:56) ~[red5-server.jar:na]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-2.1.6.jar:na]
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz-2.1.6.jar:na]
2013-08-28 13:15:33,154 [NioProcessor-34] INFO  
o.r.s.stream.ClientBroadcastStream - Stream close
2013-08-28 13:15:33,155 [NioProcessor-34] INFO  
o.r.s.stream.ClientBroadcastStream - Provider disconnect
2013-08-28 13:15:33,156 [NioProcessor-34] INFO  test.Application - 
streamRecordStop | enter, publishedName:192.168.62.141-20130828131509-32, 
current connention count:15

Original issue reported on code.google.com by Taly....@gmail.com on 28 Aug 2013 at 9:20

Attachments:

GoogleCodeExporter commented 9 years ago
I'll take a look, but my first thought is: did you set a new name for your file 
that differs from the one red5 creates when recording?

Original comment by mondain on 28 Aug 2013 at 3:26

GoogleCodeExporter commented 9 years ago
Hi, mondain. 

Yes, I set a different name to every record stream when call 
NetStream.publish(diffrentName, "record") method in FLEX client. 

Original comment by Taly....@gmail.com on 29 Aug 2013 at 1:21

GoogleCodeExporter commented 9 years ago
Try a newer version of 1.0.2 and let me know if you still see the same issue. 
It looks like this consumer is uninitialized at some point, but the queue is 
not cleared for the particular stream.

Original comment by mondain on 29 Aug 2013 at 2:49

GoogleCodeExporter commented 9 years ago
Hi, mondain.

What do you mean "a newer version of 1.0.2"? (Wait for a newer version of 
1.0.2, like '1.0.2 Final'?)

By the way, I did the same test with 1.0.0 Final Version today, and 1.0.0 
haven't this issues.

Original comment by Taly....@gmail.com on 29 Aug 2013 at 4:51

GoogleCodeExporter commented 9 years ago
If you want to display stream information and not do an "extra" recording, then 
you should not be extending RecordingListener; That class records to a file! 
Create your class implementing IStreamListener and add it to your stream in the 
streamPublishStart method.

    @Override
    public void streamPublishStart(final IBroadcastStream stream) {
        log.debug("streamPublishStart - stream name: {}", stream.getPublishedName());
        if (stream instanceof ClientBroadcastStream) {
            // create and add the stream listener
            ((ClientBroadcastStream) stream).addStreamListener(new MyCustomStreamListener());
        }       
    }

Original comment by mondain on 29 Aug 2013 at 7:50

GoogleCodeExporter commented 9 years ago
Also the latest stable "trunk" builds can be found here: 
https://builds.apache.org/job/Red5%20Trunk/

Original comment by mondain on 29 Aug 2013 at 7:52