[ 
https://issues.apache.org/jira/browse/SUREFIRE-1422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389954#comment-16389954
 ] 

Thomas Raehalme edited comment on SUREFIRE-1422 at 3/7/18 6:48 PM:
-------------------------------------------------------------------

I've written about the issue [on my 
blog|http://raehal.me/maven-surefire-plugin-on-Docker/] with examples of both 
output and contents of the dump file. 

You can verify the ps functionality with Docker:
{code:java}
$ docker run -it --rm maven:3.5.2-jdk-8-alpine /bin/sh
/ # ps --help
BusyBox v1.25.1 (2016-10-26 16:15:20 GMT) multi-call binary.

Usage: ps [-o COL1,COL2=HEADER]

Show list of processes

-o COL1,COL2=HEADER     Select columns for display
/ # 
{code}
As you can see the default implementation from BusyBox in Alpine is rather 
limited regarding options. And this is when the problem occurs with the 2.21.0 
version. If you downgrade to version 2.20 there is no problem.

Also if you install the {{procps}} package, you get the needed options and then 
also 2.21.0 works as intended.
{code:java}
$ docker run -it --rm maven:3.5.2-jdk-8-alpine /bin/sh
/ # apk add --update procps
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
(1/3) Installing libintl (0.19.8.1-r0)
(2/3) Installing libproc (3.3.12-r1)
(3/3) Installing procps (3.3.12-r1)
Executing busybox-1.25.1-r0.trigger
OK: 110 MiB in 62 packages
/ # ps --help all

Usage:
 ps [options]

Basic options:
 -A, -e               all processes
 -a                   all with tty, except session leaders
  a                   all with tty, including other users
 -d                   all except session leaders
 -N, --deselect       negate selection
  r                   only running processes
  T                   all processes on this terminal
  x                   processes without controlling ttys

Selection by list:
 -C <command>         command name
 -G, --Group <GID>    real group id or name
 -g, --group <group>  session or effective group name
 -p, p, --pid <PID>   process id
        --ppid <PID>  parent process id
 -q, q, --quick-pid <PID>
                      process id (quick mode)
 -s, --sid <session>  session id
 -t, t, --tty <tty>   terminal
 -u, U, --user <UID>  effective user id or name
 -U, --User <UID>     real user id or name

  The selection options take as their argument either:
    a comma-separated list e.g. '-u root,nobody' or
    a blank-separated list e.g. '-p 123 4567'

Output formats:
 -F                   extra full
 -f                   full-format, including command lines
  f, --forest         ascii art process tree
 -H                   show process hierarchy
 -j                   jobs format
  j                   BSD job control format
 -l                   long format
  l                   BSD long format
 -M, Z                add security data (for SELinux)
 -O <format>          preloaded with default columns
  O <format>          as -O, with BSD personality
 -o, o, --format <format>
                      user-defined format
  s                   signal format
  u                   user-oriented format
  v                   virtual memory format
  X                   register format
 -y                   do not show flags, show rss vs. addr (used with -l)
     --context        display security context (for SELinux)
     --headers        repeat header lines, one per page
     --no-headers     do not print header at all
     --cols, --columns, --width <num>
                      set screen width
     --rows, --lines <num>
                      set screen height

Show threads:
  H                   as if they were processes
 -L                   possibly with LWP and NLWP columns
 -m, m                after processes
 -T                   possibly with SPID column

Miscellaneous options:
 -c                   show scheduling class with -l option
  c                   show true command name
  e                   show the environment after command
  k,    --sort        specify sort order as: [+|-]key[,[+|-]key[,...]]
  L                   show format specifiers
  n                   display numeric uid and wchan
  S,    --cumulative  include some dead child process data
 -y                   do not show flags, show rss (only with -l)
 -V, V, --version     display version information and exit
 -w, w                unlimited output width

        --help <simple|list|output|threads|misc|all>
                      display help and exit

For more details see ps(1).
/ # 
{code}
Hope this helps! If I can help with anything please let me know.


was (Author: raehalme):
I've written about the issue [on my 
blog|http://raehal.me/maven-surefire-plugin-on-Docker/] with examples of both 
output and contents of the dump file. 

You can verify the ps functionality with Docker:
{code:java}
$ docker run -it --rm maven:3.5.2-jdk-8-alpine /bin/sh
/ # ps --help
BusyBox v1.25.1 (2016-10-26 16:15:20 GMT) multi-call binary.

Usage: ps [-o COL1,COL2=HEADER]

Show list of processes

-o COL1,COL2=HEADER     Select columns for display
/ # 
{code}
As you can see the default implementation from BusyBox in Alpine is rather 
limited regarding options.

But if you install the {{procps}} package, you get the needed options.
{code:java}
$ docker run -it --rm maven:3.5.2-jdk-8-alpine /bin/sh
/ # apk add --update procps
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
(1/3) Installing libintl (0.19.8.1-r0)
(2/3) Installing libproc (3.3.12-r1)
(3/3) Installing procps (3.3.12-r1)
Executing busybox-1.25.1-r0.trigger
OK: 110 MiB in 62 packages
/ # ps --help all

Usage:
 ps [options]

Basic options:
 -A, -e               all processes
 -a                   all with tty, except session leaders
  a                   all with tty, including other users
 -d                   all except session leaders
 -N, --deselect       negate selection
  r                   only running processes
  T                   all processes on this terminal
  x                   processes without controlling ttys

Selection by list:
 -C <command>         command name
 -G, --Group <GID>    real group id or name
 -g, --group <group>  session or effective group name
 -p, p, --pid <PID>   process id
        --ppid <PID>  parent process id
 -q, q, --quick-pid <PID>
                      process id (quick mode)
 -s, --sid <session>  session id
 -t, t, --tty <tty>   terminal
 -u, U, --user <UID>  effective user id or name
 -U, --User <UID>     real user id or name

  The selection options take as their argument either:
    a comma-separated list e.g. '-u root,nobody' or
    a blank-separated list e.g. '-p 123 4567'

Output formats:
 -F                   extra full
 -f                   full-format, including command lines
  f, --forest         ascii art process tree
 -H                   show process hierarchy
 -j                   jobs format
  j                   BSD job control format
 -l                   long format
  l                   BSD long format
 -M, Z                add security data (for SELinux)
 -O <format>          preloaded with default columns
  O <format>          as -O, with BSD personality
 -o, o, --format <format>
                      user-defined format
  s                   signal format
  u                   user-oriented format
  v                   virtual memory format
  X                   register format
 -y                   do not show flags, show rss vs. addr (used with -l)
     --context        display security context (for SELinux)
     --headers        repeat header lines, one per page
     --no-headers     do not print header at all
     --cols, --columns, --width <num>
                      set screen width
     --rows, --lines <num>
                      set screen height

Show threads:
  H                   as if they were processes
 -L                   possibly with LWP and NLWP columns
 -m, m                after processes
 -T                   possibly with SPID column

Miscellaneous options:
 -c                   show scheduling class with -l option
  c                   show true command name
  e                   show the environment after command
  k,    --sort        specify sort order as: [+|-]key[,[+|-]key[,...]]
  L                   show format specifiers
  n                   display numeric uid and wchan
  S,    --cumulative  include some dead child process data
 -y                   do not show flags, show rss (only with -l)
 -V, V, --version     display version information and exit
 -w, w                unlimited output width

        --help <simple|list|output|threads|misc|all>
                      display help and exit

For more details see ps(1).
/ # 
{code}
The problem only occurs when the {{procps}} package has not been installed.

Hope this helps! If I can help with anything please let me know.

> Forking fails on Linux if /bin/ps isn't available
> -------------------------------------------------
>
>                 Key: SUREFIRE-1422
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1422
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: process forking
>    Affects Versions: 2.20.1
>         Environment: Linux (Debian 9 with OpenJDK 8)
>            Reporter: Emmanuel Bourg
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: 2.21.0
>
>
> Hi,
> With the changes introduced by SUREFIRE-1302 I'm now experiencing a failure 
> on Linux when the fork mode is enabled:
> {code}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on 
> project foo: There are test failures.
> [ERROR]
> [ERROR] Please refer to /foo/target/surefire-reports for the individual test 
> results.
> [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, 
> [date].dumpstream and [date]-jvmRun[N].dumpstream.
> [ERROR] The forked VM terminated without properly saying goodbye. VM crash or 
> System.exit called?
> {code}
> I traced the issue back to the PpidChecker class, the code assumes that 
> {{/bin/ps}} or {{/usr/bin/ps}} exist but this isn't guaranteed (especially on 
> trimmed down containers commonly used for continuous integration).
> It would be nice to have a fallback mechanism when ps isn't available, or at 
> least check its existence and display an explicit message stating that it 
> must be installed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to