Audio/video stream recording forums

Attention Visitor:
You may have to register or log in before you can post:
  • Click the register link to sign up.
  • Registered members please fill in the form below and click the "Log in" button.
To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Audio/video stream recording forums > Streaming media recording forum > rtmpdump
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #1  
Old 02-20-2013, 11:46 AM
jerimiah797 jerimiah797 is offline
Junior Member
 
Join Date: Feb 2013
Posts: 2
jerimiah797 is on a distinguished road
Default

rtmpgw is spiking the processor when run in background - solved


Hi everyone. I don't know how many people have seen this problem, but I figured out a solution so I thought I would share it.

Problem: when invoking rtmpgw from the shell with nohup to detach it from the shell and let it run as a daemon in the background, the process would jump to 100% cpu even though it was just sitting there waiting for further commands.

nohup rtmpgw -g 8902 > rtmplog.txt 2>&1 & exit

The log that nohup produced after just a few seconds was tens of thousands of lines of repeating text like this:

HTTP-RTMP Stream Gateway v2.4
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL

Streaming on http://0.0.0.0:8902
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring
Unknown command '<FF>', ignoring

I tracked this down to a bug in the source code that gets confused when stdin is closed, and reacts as if the computer is continually typing the EOF character, generating the above error message.

This can be worked around by deleting most of the code in the area where keyboard input is processed. The only thing this part of the code does is listen for the letter 'q', to quit the server. It returns an error for anything else. Since it is just as easy to hit Ctrl-C as it is to hit q to quit the server, this code is really unnecessary. It starts on line 272 of rtmpgw.c

controlServerThread(void *unused)
{
/*
char ich;
while (1)
{
ich = getchar();
switch (ich)
{
case 'q':
RTMP_LogPrintf("Exiting\n");
stopStreaming(httpServer);
exit(0);
break;
default:
//RTMP_LogPrintf("Unknown command \'%c\', ignoring\n", ich);
break;
}
}
*/
TFRET();
}

I simply inserted C-language comment codes to comment out the whole code block. Then recompile, and everything works as expected.

If any of the devs see this, they may want to consider adding a command line switch to shut this part of the code down when you want to run rtmpgw as a detached background process or daemon.

Hope this helps.

-jerimiah797

Last edited by jerimiah797 : 02-20-2013 at 11:54 AM. Reason: fix typos
Reply With Quote
  #2  
Old 02-26-2013, 05:28 AM
superneo superneo is offline
Junior Member
 
Join Date: Feb 2013
Posts: 1
superneo is on a distinguished road
Default

Re: rtmpgw is spiking the processor when run in background - solved


Thank you for good information.

I have to see the same problem.

Dreambox 800HD consume 90% of CPU and hang.I try to find to solve this problem and found this forum.But I can't compile rtmpgw.c for dreambox 800HD.

Can you suggest me to compile rtmpgw.c for dreambox?

Thank a lot
Reply With Quote
  #3  
Old 03-13-2013, 10:05 PM
cuhaos cuhaos is offline
Junior Member
 
Join Date: Mar 2013
Posts: 1
cuhaos is on a distinguished road
Default

Re: rtmpgw is spiking the processor when run in background - solved


Wow! Thanks for posting this. You saved me some time figuring it out.

If anyone else comes across this, I've forked rmtpdump and implemented the commenting mentioned here at:

https://github.com/krisf/rtmpdump

I also added a sample init script that works on RHEL/CentOS for use with rtmpsuck
Reply With Quote
  #4  
Old 04-18-2013, 04:15 PM
jerimiah797 jerimiah797 is offline
Junior Member
 
Join Date: Feb 2013
Posts: 2
jerimiah797 is on a distinguished road
Default

Re: rtmpgw is spiking the processor when run in background - solved


Awesome, thanks for the github link.

-jerimiah
Reply With Quote
Reply Post New Thread
Tags: ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 12:38 AM.


Powered by All-streaming-media.com; 2006-2011
vB forum hacked with Zoints add-ons