Jump to content
MartinJ

Switch hangs in Command-line Mode

Recommended Posts

A command-line initiation of Switch to convert a folder full of wav files to mp3 files in a different folder stalls on the 11'th file. If a couple of files are deleted from the beginning of the input folder Switch still stalls on the 11'th file in the reduced list - it therefore seems that the problem is not specific to my particular files but rather a problem with Switch's scheduling.

 

I'm launching Switch from a Java program running under Netbeans by means of a "Runtime.getRuntime().exec(switchCommand)" command.

 

Curiously, if Switch is already running, the problem disappears. Unfortunately, starting Switch from Java first and then requesting the conversion via a second exec command doesn't achieve the same effect. The problem seems to arise precisely because Switch is launched from Java.

 

I'm running the paid-up version.

 

Anybody else seen this problem?

Share this post


Link to post
Share on other sites

Hi MartinJ,

When you run Switch from your Java program, are you running other threads which could be manipulating the target files? My first thought is that something is going wrong with Switch's access to the files.

Regards

Ben

Share this post


Link to post
Share on other sites

Hi Ben,

 

Thanks for picking this up so promptly.

 

I can be pretty sure there's nothing blocking directory access as the program at least makes a start. Likewise I can be pretty sure it's not the file being processed at the time as if I delete a file above it, the hang point drops to the next file down.

 

/My/ initial thought was that I was because, when I first encountered the problem, I was operating "non-commercially". But paying up made no difference.

 

The fact that the batch runs happily when Switch is first started independently suggests that it's Java that's tying up a resource somewhere. But what and where? There must be some significance to the fact that it seems it's always the /11'th/ file that causes the problem.

 

Regards, MartinJ

Share this post


Link to post
Share on other sites

Hi MartinJ,

A few thoughts:

 

1. It does seem likely to be something to do with being the 11th file, but could it also be a certain time duration? ie. Are all your files about the same length? If so, could it be that the problem is actually a time based issue rather than an item count?

 

2. What is your Java program doing while Switch is operating?

 

3. I don't know much about the inner workings of the JVM, but when you execute a command line from within a Java program does it run within the context of the Java program?

 

Regards,

Ben

Share this post


Link to post
Share on other sites

Hi Ben. Thinking this through again, I think you're right to point me towards looking at the characteristics of the files I'm converting. Memory is the most likely problem and since my files are all more or less the same size, dropping (or adding) a few isn't going to make any difference to the point at which the hang occurs.

 

It's dawning on me that this is probably now my problem rather than yours. I've read a bit more about the exec method and I see there are constructors that allow me to configure the "environment". I'm working under Windows 8 (sorry, should have mentioned this earlier, I suppose) and am used to things just looking after themselves. I'm going to research this a bit more thoroughly now and also see what happens with smaller files. I'll post again when I have more information..

 

Thanks again for your time.

 

Regards, MJ

Share this post


Link to post
Share on other sites

Hi again. A bit more information for you, Ben

 

I reran my Java program and pointed Switch at a folder of tiny files. It started fine, but this time when it reached file 10 (note, not 11, as before) it stalled again, displaying "Converting file 10" . However (and this might have been true for the larger files if I'd been patient enough) it then picked up, flagged a conversion error in the Switch window, and carried on to the next file. This was treated in the same way, and so on to the end of the folder. Each file (16K in length) after file 9 took about 5sec for Switch to decide it didn't like it.

 

I've investigated the Java "environment parameter" settings and have found that they're the options you might specify when launching a Java program - see here. Since I'm not currently specifying any, my exec(command) instruction is apparently launching Switch with the options that accompany Netbeans. They're multitudinous. I've played around with the one that seems to specify the amount of memory that Java allocates (eg -Xms1024m) but haven't observed any effect.

 

At this point, unless you've any ideas and can maybe tell me that Switch needs something special in its execution parameters, I think I'll accept I'm /way/ out of my depth and will just be grateful that things work when I start Switch manually first.

 

Best wishes, MJ

Share this post


Link to post
Share on other sites

Hi Martin,

There is nothing special in the way that Switch is run. It is a basic command line entry with a handful of parameters.

 

As I said, I'm not very familiar with the JVM, so I'm afraid I'm not going to be able to be much help for you. However, I'm happy to answer any questions you might have about Switch while you are troubleshooting your code.

 

Regards,

Ben

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...