ulimit not reflected for jenkins slave
Solution 1:
Make sure pam_limits.so is enabled for su if your jenkins startup script is using "su" for user switching.
For Ubuntu Server, uncomment "session required pam_limits.so" line in /etc/pam.d/su file
sudo sed -i '/# session\s\+required\s\+pam_limits.so/ s/# *//' /etc/pam.d/su
Solution 2:
By default Jenkins establish a SSH connection with each of the Node/Slave as userx.
I set the ulimit, took the node offline and bring it back and I thought the problem is on the session side.
So Disconnect
ed the whole node from the jenkins and restarted the connection with it again.
It brought back a new session for userx and it obviously worked.
My bad that I didn't look through the logs when I took the node offline.
Remember: Taking a jenkins node offline and bringing it back won't bring up a new SSH session.