ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have this problem and can't overcome it. Maybe someone of You has an idea. I would really appreciate it. So goint to the problem...
In my application I need to start mplayer with radiostation url. And it works for few first times. After I play with some gui in the application and want to start the process again, I get FailedToStart error and nothing happens. The arguments are the same, and the program "mplayer" still exists.
In the documentation, they write:
"The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program."
However this is obvious, none of the cases apply to mine. But it still fails.
Additionally, this happens when the program is run on Embedded Linux (on ARM). Running on Ubuntu, haven't gotten this kind of problem. So maybe it has something to do with resources, but how can I check it? How can I affect it, to correct? Please, I need this badly!
I have this problem and can't overcome it. Maybe someone of You has an idea. I would really appreciate it. So goint to the problem...
In my application I need to start mplayer with radiostation url. And it works for few first times. After I play with some gui in the application and want to start the process again, I get FailedToStart error and nothing happens. The arguments are the same, and the program "mplayer" still exists.
In the documentation, they write:
"The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program."
However this is obvious, none of the cases apply to mine. But it still fails.
Additionally, this happens when the program is run on Embedded Linux (on ARM). Running on Ubuntu, haven't gotten this kind of problem. So maybe it has something to do with resources, but how can I check it? How can I affect it, to correct? Please, I need this badly!
Thank You in advance, for any help.
Do you have source code of the application which starts 'mplayer' ?
Ahh sorry, I haven't included the part of code taking care of errors. So here it comes:
Code:
void MediaClass::handleErrors(QProcess::ProcessError error)
{
switch(error)
{
case (Process::FailedToStart):
qDebug()<<"AlsaAudioFunctions::handleErrors() : Process::FailedToStart";
break;
case (Process::Crashed):
qDebug()<<"AlsaAudioFunctions::handleErrors() : Process::Crashed";
break;
case (Process::WriteError):
qDebug()<<"AlsaAudioFunctions::handleErrors() : Process::WriteError";
break;
case (Process::Timedout):
qDebug()<<"AlsaAudioFunctions::handleErrors() : Process::Timedout";
break;
case (Process::ReadError):
qDebug()<<"AlsaAudioFunctions::handleErrors() : Process::Crashed";
break;
default:
qDebug()<<"AlsaAudioFunctions::handleErrors() :unknown error";
break;
}
Process *process=dynamic_cast<Process*>(sender());
if (process)
{
qDebug()<<"AlsaAudioFunctions::handleErrors() : "<<"Process22";
process->close();
if(process)
{
qDebug()<<"AAF : delte";
process->deleteLater();
}
}
else
qDebug()<<"AlsaAudioFunctions::handleErrors() : "<<"Not recognized as QProcess";
}
So at this point I get sometimes an error saying: "AlsaAudioFunctions::handleErrors() : Process::FailedToStart".
The Process class is derived from Process. Only destructor and constructor functions are defined there, to indicate me if all the instances were deleted after creation.
Thank You.
Last edited by Krzysztow; 04-21-2010 at 05:54 PM.
Reason: a mistake done
...
So at this point I get sometimes an error saying: "AlsaAudioFunctions::handleErrors() : Process::FailedToStart".
The Process class is derived from Process. Only destructor and constructor functions are defined there, to indicate me if all the instances were deleted after creation.
Thank You.
So, the error is obviously ALSA related - assuming the diagnostics are correct. You'll have to dig into 'mplayer' + ALSA.
My wild guess is that either another instance of 'mplayer' exists grabbing ALSA or when killing 'mplayer' (do you do this ?) previous instance you do not wait long enough.
Generally speaking, sending KILL to a process does not necessarily kill it immediately.
I'd suggest to temporarily wrap 'mplayer' into a script and call the script rather than 'mplayer' directly. In the script you can put various diagnostics before actually calling 'mplayer' - for example, 'ps auwx | grep mplayer' or something like this ('pgrep' ?) in order to check whether previous 'mplayer' instance still exists. And/or to check ALSA status. Things like that.
So, the error is obviously ALSA related - assuming the diagnostics are correct. You'll have to dig into 'mplayer' + ALSA.
My wild guess is that either another instance of 'mplayer' exists grabbing ALSA or when killing 'mplayer' (do you do this ?) previous instance you do not wait long enough.
Generally speaking, sending KILL to a process does not necessarily kill it immediately.
I'd suggest to temporarily wrap 'mplayer' into a script and call the script rather than 'mplayer' directly. In the script you can put various diagnostics before actually calling 'mplayer' - for example, 'ps auwx | grep mplayer' or something like this ('pgrep' ?) in order to check whether previous 'mplayer' instance still exists. And/or to check ALSA status. Things like that.
This "AlsaAudioFunctions::handleErrors() : Process::FailedToStart" message is just my message from handleErrors() function (I left this name, since earlier I called it like that). It shouldn't be a problem of mplayer or alsa. I checked from console if I can start more than one mplayers with the links like that and it is possible, all is fine. Only from within qt application it fails. And when it does fail, I can check the list of running processes by ps -A and there is no other mplayer left. So probably it's not the case.
surely the problem is not Alsa specific, because when this mplayer fails, also QProcess with udhcp fails.
Before this failures happen, udhcp process works perfectly fine.
Thank You for any ideas!
Me once more...
So I run my application and on the second consloe observe the "top" output. And this QProcess::FailedToStart comes out, when the VSZ (Virrtual Memory Size) approaches 270m. But from the console mplayer may be played, so this is not a physical limitation of the hardware, but probably some limitation to a process.
So this is the state (top process run) when mplayer is running correctly:
The multitude (as well as more than 100% VSZ size) of tasks is due to few plug-ins loaded. All of these tasks have the same limits, which are (cat /proc/2229/task/<number>/limits and cat /proc/2229/limits):
Code:
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited ms
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 0 bytes
Max resident set unlimited unlimited bytes
Max processes 512 512 processes
Max open files 1024 1024 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 512 512 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
Hope this information is important and useful for solution. Please, if anyone has some thoughts on that, write them here.
Thank You in advance,
Thank You.
Last edited by Krzysztow; 04-22-2010 at 05:11 AM.
Reason: Additional information
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.