You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Hannes Schmidt (JIRA)" <ji...@apache.org> on 2008/06/03 23:14:45 UTC

[jira] Created: (SOLR-590) Limitation in pgrep on Linux platform breaks script-utils fixUser

Limitation in pgrep on Linux platform breaks script-utils fixUser 
------------------------------------------------------------------

                 Key: SOLR-590
                 URL: https://issues.apache.org/jira/browse/SOLR-590
             Project: Solr
          Issue Type: Bug
    Affects Versions: 1.2
         Environment: Linux 2.6.18-53.1.14.el5 #1 SMP Wed Mar 5 11:37:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
procps-3.2.7-8.1.el5
            Reporter: Hannes Schmidt


The fixUser function in script-utils uses two methods to determine the username of the parent process (oldwhoami). If the first method fails for certain reasons it will fallback to the second method. For most people the first method will succeed but I know that in my particular installation the first method fails so I need the second method to succeed. Unfortunately, that fallback method doesn't work because it uses pgrep to lookup the current script's name and on my Linux 2.6.18 platform pgrep is limited to 15 characters. The names of many scripts in the SOLR distribution are longer than that, causing pgrep to return nothing and the subsequent ps invocation to fail with an error:

ERROR: List of process IDs must follow -p.

You can easily reproduce that behaviour with

/app/solr/solr/bin/snappuller-enable < /dev/null

The redirection of stdin from /dev/null causes fixUser to fallback to the second method but there are other, more realistic scenarios in which the fallback happens, like

ssh jetty@host /app/solr/solr/bin/snappuller-enable

The fix is to use the -f option which causes pgrep to compare the full path of the executable. Interestingly, that method is not subject to the 15 character length limit. The limit is not actually enforced by jetty but rather by the procfs file system of the linux kernel. If you look at /proc/*/stat you will notice that the second column is limited to 15 characters.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SOLR-590) Limitation in pgrep on Linux platform breaks script-utils fixUser

Posted by "Bill Au (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Au reassigned SOLR-590:
----------------------------

    Assignee: Bill Au

> Limitation in pgrep on Linux platform breaks script-utils fixUser 
> ------------------------------------------------------------------
>
>                 Key: SOLR-590
>                 URL: https://issues.apache.org/jira/browse/SOLR-590
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: Linux 2.6.18-53.1.14.el5 #1 SMP Wed Mar 5 11:37:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
> procps-3.2.7-8.1.el5
>            Reporter: Hannes Schmidt
>            Assignee: Bill Au
>            Priority: Minor
>         Attachments: fixUser.patch
>
>
> The fixUser function in script-utils uses two methods to determine the username of the parent process (oldwhoami). If the first method fails for certain reasons it will fallback to the second method. For most people the first method will succeed but I know that in my particular installation the first method fails so I need the second method to succeed. Unfortunately, that fallback method doesn't work because it uses pgrep to lookup the current script's name and on my Linux 2.6.18 platform pgrep is limited to 15 characters. The names of many scripts in the SOLR distribution are longer than that, causing pgrep to return nothing and the subsequent ps invocation to fail with an error:
> ERROR: List of process IDs must follow -p.
> You can easily reproduce that behaviour with
> /app/solr/solr/bin/snappuller-enable < /dev/null
> The redirection of stdin from /dev/null causes fixUser to fallback to the second method but there are other, more realistic scenarios in which the fallback happens, like
> ssh jetty@host /app/solr/solr/bin/snappuller-enable
> The fix is to use the -f option which causes pgrep to compare the full path of the executable. Interestingly, that method is not subject to the 15 character length limit. The limit is not actually enforced by jetty but rather by the procfs file system of the linux kernel. If you look at /proc/*/stat you will notice that the second column is limited to 15 characters.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-590) Limitation in pgrep on Linux platform breaks script-utils fixUser

Posted by "Hannes Schmidt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hannes Schmidt updated SOLR-590:
--------------------------------

    Attachment: fixUser.patch

Attaching patch.

> Limitation in pgrep on Linux platform breaks script-utils fixUser 
> ------------------------------------------------------------------
>
>                 Key: SOLR-590
>                 URL: https://issues.apache.org/jira/browse/SOLR-590
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: Linux 2.6.18-53.1.14.el5 #1 SMP Wed Mar 5 11:37:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
> procps-3.2.7-8.1.el5
>            Reporter: Hannes Schmidt
>            Priority: Minor
>         Attachments: fixUser.patch
>
>
> The fixUser function in script-utils uses two methods to determine the username of the parent process (oldwhoami). If the first method fails for certain reasons it will fallback to the second method. For most people the first method will succeed but I know that in my particular installation the first method fails so I need the second method to succeed. Unfortunately, that fallback method doesn't work because it uses pgrep to lookup the current script's name and on my Linux 2.6.18 platform pgrep is limited to 15 characters. The names of many scripts in the SOLR distribution are longer than that, causing pgrep to return nothing and the subsequent ps invocation to fail with an error:
> ERROR: List of process IDs must follow -p.
> You can easily reproduce that behaviour with
> /app/solr/solr/bin/snappuller-enable < /dev/null
> The redirection of stdin from /dev/null causes fixUser to fallback to the second method but there are other, more realistic scenarios in which the fallback happens, like
> ssh jetty@host /app/solr/solr/bin/snappuller-enable
> The fix is to use the -f option which causes pgrep to compare the full path of the executable. Interestingly, that method is not subject to the 15 character length limit. The limit is not actually enforced by jetty but rather by the procfs file system of the linux kernel. If you look at /proc/*/stat you will notice that the second column is limited to 15 characters.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-590) Limitation in pgrep on Linux platform breaks script-utils fixUser

Posted by "Bill Au (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Au resolved SOLR-590.
--------------------------

    Resolution: Fixed

Patch commited and CHANGES.txt updated.  Thanks Hannes.

Sending        CHANGES.txt
Sending        src/scripts/scripts-util
Transmitting file data ..
Committed revision 663089.


> Limitation in pgrep on Linux platform breaks script-utils fixUser 
> ------------------------------------------------------------------
>
>                 Key: SOLR-590
>                 URL: https://issues.apache.org/jira/browse/SOLR-590
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: Linux 2.6.18-53.1.14.el5 #1 SMP Wed Mar 5 11:37:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
> procps-3.2.7-8.1.el5
>            Reporter: Hannes Schmidt
>            Assignee: Bill Au
>            Priority: Minor
>         Attachments: fixUser.patch
>
>
> The fixUser function in script-utils uses two methods to determine the username of the parent process (oldwhoami). If the first method fails for certain reasons it will fallback to the second method. For most people the first method will succeed but I know that in my particular installation the first method fails so I need the second method to succeed. Unfortunately, that fallback method doesn't work because it uses pgrep to lookup the current script's name and on my Linux 2.6.18 platform pgrep is limited to 15 characters. The names of many scripts in the SOLR distribution are longer than that, causing pgrep to return nothing and the subsequent ps invocation to fail with an error:
> ERROR: List of process IDs must follow -p.
> You can easily reproduce that behaviour with
> /app/solr/solr/bin/snappuller-enable < /dev/null
> The redirection of stdin from /dev/null causes fixUser to fallback to the second method but there are other, more realistic scenarios in which the fallback happens, like
> ssh jetty@host /app/solr/solr/bin/snappuller-enable
> The fix is to use the -f option which causes pgrep to compare the full path of the executable. Interestingly, that method is not subject to the 15 character length limit. The limit is not actually enforced by jetty but rather by the procfs file system of the linux kernel. If you look at /proc/*/stat you will notice that the second column is limited to 15 characters.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-590) Limitation in pgrep on Linux platform breaks script-utils fixUser

Posted by "Hannes Schmidt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hannes Schmidt updated SOLR-590:
--------------------------------

    Priority: Minor  (was: Major)

Changing priority to minor.

> Limitation in pgrep on Linux platform breaks script-utils fixUser 
> ------------------------------------------------------------------
>
>                 Key: SOLR-590
>                 URL: https://issues.apache.org/jira/browse/SOLR-590
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: Linux 2.6.18-53.1.14.el5 #1 SMP Wed Mar 5 11:37:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
> procps-3.2.7-8.1.el5
>            Reporter: Hannes Schmidt
>            Priority: Minor
>
> The fixUser function in script-utils uses two methods to determine the username of the parent process (oldwhoami). If the first method fails for certain reasons it will fallback to the second method. For most people the first method will succeed but I know that in my particular installation the first method fails so I need the second method to succeed. Unfortunately, that fallback method doesn't work because it uses pgrep to lookup the current script's name and on my Linux 2.6.18 platform pgrep is limited to 15 characters. The names of many scripts in the SOLR distribution are longer than that, causing pgrep to return nothing and the subsequent ps invocation to fail with an error:
> ERROR: List of process IDs must follow -p.
> You can easily reproduce that behaviour with
> /app/solr/solr/bin/snappuller-enable < /dev/null
> The redirection of stdin from /dev/null causes fixUser to fallback to the second method but there are other, more realistic scenarios in which the fallback happens, like
> ssh jetty@host /app/solr/solr/bin/snappuller-enable
> The fix is to use the -f option which causes pgrep to compare the full path of the executable. Interestingly, that method is not subject to the 15 character length limit. The limit is not actually enforced by jetty but rather by the procfs file system of the linux kernel. If you look at /proc/*/stat you will notice that the second column is limited to 15 characters.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.