Jump to content

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?

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...