Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAX_N_PID should be 4194304 on 64bit machines #27

Open
merkys opened this issue Jun 18, 2020 · 10 comments
Open

MAX_N_PID should be 4194304 on 64bit machines #27

merkys opened this issue Jun 18, 2020 · 10 comments

Comments

@merkys
Copy link

merkys commented Jun 18, 2020

While using t-coffee on Debian, it has been noticed that on 64bit machines process IDs (PIDs) exceed the default MAX_N_PID setting (currently 260000) and starts acting weird (please see the original Debian bug report). I would suggest either increasing the default value of MAX_N_PID to 4194304, or doing so only when compiled 64bit machines.

@EricDeveaud
Copy link

please do nt set an hard coded value. instead use the value that the OS and kernel may supply

MAX PID can be obtain via 2 calls
eg:
cat /proc/sys/kernel/pid_max
or
sysctl kernel.pid_max

it can also be determined programaticaly

the maxpid value is set by the os and can be edited by admins why 4194304 ? size_t

examples:

maestro-submit:~ > uname -s -p -o -m
Linux x86_64 x86_64 GNU/Linux
maestro-submit:~ > sysctl kernel.pid_max
kernel.pid_max = 65536
tars-submit0:~ > uname -s -p -o -m               
Linux x86_64 x86_64 GNU/Linux
tars-submit0:~ > sysctl kernel.pid_max
kernel.pid_max = 57344

regards

Eric

@cnotred
Copy link
Contributor

cnotred commented Jul 1, 2020 via email

@merkys
Copy link
Author

merkys commented Jul 1, 2020

please do nt set an hard coded value. instead use the value that the OS and kernel may supply

Yes, this is a wise solution.

This is very useful. I will implement this ASAP

Do you mean you are going to implement taking the MAX_N_PID from the kernel in tcoffee build system?

@cnotred
Copy link
Contributor

cnotred commented Jul 1, 2020 via email

@EricDeveaud
Copy link

on my mac (Mojave) man 2 setaudit_addr says:

The ai_asid variable contains the audit session ID which is recorded with
     every event caused by the process.  It can be any value in the range 1 to
     PID_MAX (99999).  

http://www.opensource.apple.com/source/xnu/xnu-1699.24.23/bsd/sys/proc_internal.h
#define PID_MAX 99999

Eric

@Hirun
Copy link

Hirun commented Nov 18, 2020

https://apple.stackexchange.com/questions/51119/whats-the-maximum-pid-for-mac-os-x

Looking at sys/proc_internal.h in xnu-1699.24.23, I find that PID_MAX is 99999. The value is used in kern_fork.c in the function forkproc. Looking at that function, process IDs are not assigned equal to PID_MAX, so the highest possible pid is 99998

Seems like for Mac OS it is ok to hardcode the limit to 99998

nsoranzo added a commit to nsoranzo/bioconda-recipes that referenced this issue Dec 23, 2020
BiocondaBot pushed a commit to bioconda/bioconda-recipes that referenced this issue Dec 23, 2020
Merge PR #25932, commits were: 
 * Add [de]activate scripts

to workaround cbcrg/tcoffee#27
 * Skip osx

Just running `t_coffee` fails with:
```
04:33:21 BIOCONDA INFO (OUT) -max_n_proc    	D	[0] 	1
04:33:21 BIOCONDA INFO (OUT)
04:33:21 BIOCONDA INFO (OUT)
04:33:21 BIOCONDA INFO (OUT) *************************************************************************************************
04:33:21 BIOCONDA INFO (OUT) *                        FULL TRACE BACK PID: 2901
04:33:21 BIOCONDA INFO (OUT) 2901 -- ERROR: COREDUMP: T-COFFEE Version_13.45.32.7d81f5b (2020-12-18 11:45:26 - Revision 7d7e789 - Build 647)
04:33:21 BIOCONDA INFO (OUT) *************************************************************************************************
04:33:21 BIOCONDA INFO (OUT)
04:33:21 BIOCONDA INFO (OUT) 	******************************************************************
04:33:21 BIOCONDA INFO (OUT) 	* Abnormal Termination
04:33:21 BIOCONDA INFO (OUT) 	* Job NOT Completed:[T-COFFEE, Version_13.45.32.7d81f5b]
04:33:21 BIOCONDA INFO (OUT) 	* Please CHECK:
04:33:21 BIOCONDA INFO (OUT) 	* 	-1 The format of your Input Files
04:33:21 BIOCONDA INFO (OUT) 	* 	-2 The parameters
04:33:21 BIOCONDA INFO (OUT) 	* 	-3 The use of special characters in sequence names:
04:33:21 BIOCONDA INFO (OUT) 	* 		 (@, |, %...)
04:33:21 BIOCONDA INFO (OUT) 	* 	-4 The Online Doc (http://www.tcoffee.org)
04:33:21 BIOCONDA INFO (OUT) 	* 	-5 re-run your CL (see below) with the -debug option. This will produce a debug file you can send us.
04:33:21 BIOCONDA INFO (OUT) 	*
04:33:21 BIOCONDA INFO (OUT) 	*	    NO
04:33:21 BIOCONDA INFO (OUT) 	* to:
04:33:21 BIOCONDA INFO (OUT) 	* 		[email protected]
04:33:21 BIOCONDA INFO (OUT) 	* If you run T-Coffee over the WEB:
04:33:21 BIOCONDA INFO (OUT) 	* 	Windows Cut and Paste is sometimes erratic and
04:33:21 BIOCONDA INFO (OUT) 	* 	it can loose carriage returns. If you suspect this,
04:33:21 BIOCONDA INFO (OUT) 	* 	try to cut and paste through an intermediate application
04:33:21 BIOCONDA INFO (OUT) 	* 	(word pad) and inspect the results
04:33:21 BIOCONDA INFO (OUT)
04:33:21 BIOCONDA INFO (OUT)
04:33:21 BIOCONDA INFO (OUT) 	* CONFIDENTIALITY:
04:33:21 BIOCONDA INFO (OUT) 	* 	The File NO may contain your personal DATA
04:33:21 BIOCONDA INFO (OUT) 	* 	Remove ALL confidential DATA from this file BEFORE sending it
04:33:21 BIOCONDA INFO (OUT) 	******************************************************************
04:33:21 BIOCONDA INFO (OUT) # Command Line: t_coffee  [PROGRAM:T-COFFEE]
04:33:21 BIOCONDA INFO (OUT)
04:33:21 BIOCONDA INFO (OUT) # TERMINATION STATUS: FAILURE [PROGRAM: T-COFFEE pid 2901 ppid 2895
04:33:21 BIOCONDA INFO (OUT) #CL: t_coffee
```
 * Update t-coffee to 13.45.0.4846264
@marco-mariotti
Copy link

Dear Cedric and others,
it seems the issue is still there in version 13.45.0.4846264. In my ubuntu server, the precompiled bin throws the error:

--ERROR: MAX_N_PID exceded -- Recompile changing the value of MAX_N_PID (current: 260000 Requested: 407611) OR setenv MAX_N_PID_4_TCOFFEE=407611

But it gets worse: t_coffee just won't die gracefully. Instead, the process hangs around and starts to quickly eat all the memory until the whole computer crashes... unless you notice it and kill it before that happens.

The conda recipe available for t_coffee has this problem, too.

BTW because t_coffee is installed as part of the phylogenetic reconstruction tools in etetoolkit (ete_toolchain, see http://etetoolkit.org/download/), all of this may happen under the hood, without the user being conscious of even running t_coffee. I had many server crashes before I could trace what was going on.

Looks like a high priority t_coffee bug to me, as it prevents its use in any 64bit Debian-like machine.

For those ending up in this page, here's a workaround to install a working version of t_coffee in any Linux system (disclaimer, I tested it in Ubuntu only):

  • follow instructions to get the "bugged" t_coffee here
  • locate the executable and set its location to a variable, either manually:
    TC2FIX=~/.t_coffee/bin/linux/t_coffee
  • or, if you can't find it, automatically:
    TC2FIX=$(which t_coffee)
  • finally, replace the bugged t_coffee with a command that sets MAX_N_PID_4_TCOFFEE before every run:
    mv $TC2FIX $TC2FIX.cmd && (echo '#!/usr/bin/env sh'; echo 'export MAX_N_PID_4_TCOFFEE=$(cat /proc/sys/kernel/pid_max)'; echo $TC2FIX.cmd '$@' ) > $TC2FIX && chmod a+x $TC2FIX

Afterwards you should be able to run t_coffee normally.

Marco

@nsoranzo
Copy link

The conda recipe available for t_coffee has this problem, too.

@marco-mariotti The t-coffee bioconda package (with a dash not an underscore) definitely doesn't have the issue because we workaround it in https://github.com/bioconda/bioconda-recipes/blob/master/recipes/t-coffee/t_coffee.sh

@marco-mariotti
Copy link

Thanks @nsoranzo ! I tested it and yes, it works.
Unfortunately there's two different bioconda recipes, for "t-coffee" and "t_coffee".
The second one refers to t_coffee version 11.0.8, and it is still bugged.

It'd be convenient to link the second recipe to the first one. I don't know who has the admin privileges to do that.

BTW the t-coffee bioconda recipe is a great way to install t_coffee that works across platforms (though arguably a bit heavy on dependencies). To @cnotred and others: perhaps you want to mention this in the installation instructions of t_coffee

@cnotred
Copy link
Contributor

cnotred commented Dec 17, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants