Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9005873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:15:38+00:00 2026-06-16T01:15:38+00:00

I was trying to create a simple parent child process with IPC between them

  • 0

I was trying to create a simple parent child process with IPC between them using Hadoop IPC. It turns out that program executes and prints the results but it doesn’t exit. Here is the code for it.

interface Protocol extends VersionedProtocol{
  public static final long versionID = 1L;
  IntWritable getInput();
}

public final class JavaProcess implements Protocol{
  Server server;

  public JavaProcess() {
  String rpcAddr = "localhost";
  int rpcPort = 8989;
  Configuration conf = new Configuration();
  try {
    server = RPC.getServer(this, rpcAddr, rpcPort, conf);
    server.start();

  } catch (IOException e) {
    e.printStackTrace();
  }
}

public int exec(Class klass) throws IOException,InterruptedException {
  String javaHome = System.getProperty("java.home");
  String javaBin = javaHome +
      File.separator + "bin" +
      File.separator + "java";
  String classpath = System.getProperty("java.class.path");
  String className = klass.getCanonicalName();

  ProcessBuilder builder = new ProcessBuilder(
      javaBin, "-cp", classpath, className);

  Process process = builder.start();
  int exit_code = process.waitFor();
  server.stop();

  System.out.println("completed process");
  return exit_code;
}

public static void main(String...args) throws IOException, InterruptedException{
  int status = new JavaProcess().exec(JavaProcessChild.class);
  System.out.println(status);
}

@Override
public IntWritable getInput() {
  return new IntWritable(10);
}

@Override
public long getProtocolVersion(String paramString, long paramLong)
    throws IOException {
  return Protocol.versionID;
 }
}

Here is the child process class. However I have realized that it is due to RPC.getServer() on the server side that it the culprit. Is it some known hadoop bug, or I am missing something?

public class JavaProcessChild{

  public static void main(String...args){
    Protocol umbilical = null;
    try {
       Configuration defaultConf = new Configuration();
       InetSocketAddress addr = new InetSocketAddress("localhost", 8989);
       umbilical = (Protocol) RPC.waitForProxy(Protocol.class, Protocol.versionID,
            addr, defaultConf);
       IntWritable input = umbilical.getInput();

       JavaProcessChild my = new JavaProcessChild();

      if(input!=null && input.equals(new IntWritable(10))){
        Thread.sleep(10000);
      }
      else{
        Thread.sleep(1000);
      }
    } catch (Throwable e) {
      e.printStackTrace();
   } finally{
      if(umbilical != null){
        RPC.stopProxy(umbilical);
      }
  }
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:15:39+00:00Added an answer on June 16, 2026 at 1:15 am

    We sorted that out via mail. But I just want to give my two cents here for the public:

    So the thread that is not dying there (thus not letting the main thread finish) is the org.apache.hadoop.ipc.Server$Reader.
    The reason is, that the implementation of readSelector.select(); is not interruptable. If you look closely in a debugger or threaddump, it is waiting on that call forever, even if the main thread is already cleaned up.

    Two possible fixes:

    • make the reader thread a deamon (not so cool, because the selector
      won’t be cleaned up properly, but the process will end)
    • explicitly close the “readSelector” from outside when interrupting the threadpool

    However, this is a bug in Hadoop and I have no time to look through the JIRAs. Maybe this is already fixed, in YARN the old IPC is replaced by protobuf and thrift anyways.

    BTW also this is platform dependend on the implementation of the selectors, I observed these zombies on debian/windows systems, but not on redhat/solaris.

    If anyone is interested in a patch for Hadoop 1.0, email me. I will sort out the JIRA bug in the near future and edit this here with more information. (Maybe this is fixed in the meanwhile anyways).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a simple program using Gstreamer to take the input
trying to create a simple slider for an input. Using a survey gem that
I am trying to create a simple web crawler using PHP that is capable
I'm trying to create simple script that subscribes a user to a company calendar.
Im trying to create a simple pan and zoom app using silverlight 4, but
I am trying to create a simple about page that uses JQuery click to
I'm trying to create a simple web page that resembles the following: I've got
Here i am trying to create a simple client and a server using pipes.
Using LINQ-to-SQL, I would like to automatically create child records when inserting the parent
I am trying to understand in the communication between the parent and child. Disclaimer:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.