0

Running on is 32 bit Windows Server 2007 Standard Service Pack 2 using Intel XEON CPU.

I work in the enviable position to have server software that must run 16 bit software ... :)

And we have a server that serves a 16 bit program over a socket to local users.

Here is the setup:

The Java server program starts a "cmd.exe \C batchfile.bat" process. In that batchfile.bat it then sets up and runs an actual 16-bit executable (pgm.exe for all purposes).

Then it listens for requests and spawns another one as needed.

Now, this works perfectly using the JVM 1.6 version runtime. However, in Java 7 and Java 8 it hangs right at the moment the batchfile.bat actually tries to start the 16-bit exe program.

Using the TaskManager, we can see that the cmd.exe is spawned in parallel. But until the current cmd.exe leaves the 16-bit program (ntvdm.exe closes), the next cmd.exe will freeze (lock?) and stall right at running the 16-bit exe.

Clues? Something has changed between these Java versions and it is a complete mystery to us.

So, why cannot Java 7 and Java 8 start two simultaneous batchfiles using Runtime.Process and then also run them properly when the batchfiles call a 16bit exe?

The Coordinator
  • 13,007
  • 11
  • 44
  • 73
  • Could you provide a source snippet of the Java code used to start the `cmd.exe` process? – Richard Chambers Mar 05 '15 at 12:36
  • Also are there any events are showing in the Windows event logger for a possible problem with ntvdm? – Richard Chambers Mar 05 '15 at 12:43
  • Sorry, no snippet for you. The bat file is being called correctly (cmd.exe \c somebat.bat args ...) and it has been working in production for 8 years on < 1.7 JVM. The BAT file runs perfectly, even in 1.7, it is the 16-bit exe calling in the bat that fails. – The Coordinator Mar 05 '15 at 12:54
  • checked event log. Could not find any ... – The Coordinator Mar 05 '15 at 12:55
  • Another question is whether this is 32 bit or 64 bit environment. – Richard Chambers Mar 05 '15 at 12:55
  • 32 bit windows server. – The Coordinator Mar 05 '15 at 12:59
  • If you change the program started to a 32 bit program does it work fine? – Richard Chambers Mar 05 '15 at 12:59
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/72330/discussion-between-saint-hill-and-richard-chambers). – The Coordinator Mar 05 '15 at 13:00
  • According to https://blogs.oracle.com/thejavatutorials/entry/changes_to_runtime_exec_problems there were changes introduced in 1.7 that may be affecting you. Note: In JDK 7u25, the system property jdk.lang.Process.allowAmbigousCommands can be used to relax the checking process and helps as a workaround for some applications that cannot be changed. The workaround is only effective for applications that are run without a SecurityManager. – Palamino Mar 05 '15 at 14:05
  • Thanks. That's not it. The process (bat file that calls the 16bit exe) is starting fine. But all bat files are stopping execution where they call the 16bit exe until the prior 16bit exe is done. So, cmd.exe is starting, many inm parallel and running fine, the entire bat file is being processed .. up until the 16bit exe which only runs one at a time. Strange strange strange. Even worse, if I launch from command prompt it works fine. So something to do with how Java spawns processes.... or something to do with how Java and Windows work on process spawning. – The Coordinator Mar 05 '15 at 14:09
  • In the batch file that launches your 16-bit exe, try using the following command to launch the exe in a separate memory space: start /separate – Palamino Mar 06 '15 at 14:23
  • A good article on the Windows On Windows (WOW) NTVDM topic can be found at http://windowsitpro.com/systems-management/optimizing-nts-wow-subsystem – Palamino Mar 06 '15 at 14:30
  • Thanks. Tried all that. Nothing fixes it yet. – The Coordinator Mar 06 '15 at 15:14

0 Answers0