Bug 1123222 - Interrupt (core dumped) while execuing a command in su.
Summary: Interrupt (core dumped) while execuing a command in su.
Keywords:
Status: CLOSED DUPLICATE of bug 1111584
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: coreutils
Version: 6.5
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Ondrej Oprala
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-25 06:55 UTC by Shriram
Modified: 2018-12-09 18:14 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-08 10:11:37 UTC


Attachments (Terms of Use)

Description Shriram 2014-07-25 06:55:07 UTC
Description of problem:
core dump while executing a sleep in a shell script

Version-Release number of selected component (if applicable):
Redhat 6.5 (Santiago)

How reproducible:


Steps to Reproduce:
1. copy the below commands in a shell script
          echo ''
      echo 'echo "Testing Server........ ."'
       echo "Testing Server........."
      echo ''
        echo 'echo "Helo Server........"'
        echo "Helo Server........"
      echo ''
       echo 'sleep 3600s'
                     sleep 3600s 
 
2.  change the permission to 777 
3.  execute the shell script by using below command
        su - root -c /tmp/command.sh
After sometime press ctrl+c to stop the script you will get 
  ^CInterrupt (core dumped)

Actual results:
 Actual result is ^CInterrupt (core dumped) it interrupts my application.

Expected results:
 It should not show core dump.

Additional info:
     I am executing the above command from java program. After dumping core it stops the java application. Actually it should proceed with remaining steps in my program. In RHEL 6.4 it is working fine.

Comment 5 Ondrej Oprala 2014-07-25 11:42:46 UTC
> Additional info:
>      I am executing the above command from java program. After dumping core
> it stops the java application. Actually it should proceed with remaining
> steps in my program. In RHEL 6.4 it is working fine.

This might have something to do with su now killing itself with the same signal the child receives. Could you please give me more info about that last part? Or perhaps provide me with a relevant part of the java code snippet?
Thanks.

Comment 6 Shriram 2014-07-25 12:05:15 UTC
(In reply to Ondrej Oprala from comment #5)
> > Additional info:
> >      I am executing the above command from java program. After dumping core
> > it stops the java application. Actually it should proceed with remaining
> > steps in my program. In RHEL 6.4 it is working fine.
> 
> This might have something to do with su now killing itself with the same
> signal the child receives. Could you please give me more info about that
> last part? Or perhaps provide me with a relevant part of the java code
> snippet?
> Thanks.

Thanks Ondrej 

import java.io.IOException;

public class ProcessBuilderTest {

        public static void main(String[] args) {
                
                String[] commandArgs = { "su","root", "/tmp/command.sh" };
                Process currentProcess;
                ProcessBuilder builder = new ProcessBuilder(commandArgs);

                try {
                        currentProcess = builder.start();
                        int exitStatus = currentProcess.waitFor();
                        System.out.println(" Sub Process Ends with exitCode = "
                                        + exitStatus);
                        currentProcess.destroy();                        
                        int i = 0;
                        while (i < 15) {
                                Thread.sleep(1000);
                                System.out.println(" i value = " + i++);
                        }
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }

}

Just run the above program and the prompts sleeps for one hour(3600s). Open another terminal and grep for command.sh using "ps -ef | grep command.sh".
It will list the script and bash process. kill the command.sh process using "kill <pid of the command.sh>". 
After destroying the sub process while loop should continue its execution[because it is in main process]. In RHEL 6.4 while loop will continue its exection but in RHEL 6.5 fails and stops java main process.
Hope it helps.

Thanks 
Shriram.

Comment 7 Shriram 2014-07-29 05:28:58 UTC
Any update?

Comment 8 Ondrej Oprala 2014-07-29 11:05:31 UTC
Hi Shriram,
I'm able to reproduce the first part ("core dumped") with coreutils in 6.5, though that's just a more verbose way of su's workings. I'm so far unable to reproduce the for cycle failing. With your reproducer, both rhel 6.4 and 6.5 versions finish the loop. I'll be trying with a vanilla 6.5 today.

Comment 9 Ondrej Oprala 2014-07-29 11:41:53 UTC
Nope. Vanilla yields the same results :/ . Do you have anything special set/installed on your system or within java. Signal dispositions, dump/other settings in procfs...?

Comment 10 Ondrej Oprala 2014-08-05 09:05:36 UTC
One more thing. What version of openJDK are you using? Also, do you use any java subparts from software collections...?
Thanks

Comment 11 Shriram 2014-08-06 09:48:19 UTC
I am not using open jdk instead using oracle jdk 1.7-u 55 and tested with jdk 1.7-u25. Getting the same error. I am checking with the other packages.. 
No logs are getting dumped. Is there any way to enable loggin for this particular scenario?


Note You need to log in before you can comment on or make changes to this bug.