Thursday, August 13, 2015

Skype hanging on login on Linux

I just spent a couple days trying to figure out why Skype would hang after entering the login name and password.  Skype would just sit there and spin.  This only happened on a specific user's environment.  After comparing some strace output from a successful login and a failed one I noticed mmap2() failing:

clone(child_stack=0xe21ff364, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|C
LONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0xe21ffba8, tl
s={entry_number:12, base_addr:0xe21ffb40, limit:1048575, seg_32bit:1, contents:0, read_exec_only
:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xe21ffba8) = 5793
 mmap2(NULL, 201330688, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0 <unfin
ished ...>
 <... mmap2 resumed> )             = -1 ENOMEM (Cannot allocate memory) 
 
I finally determined that this the action of pthread_create() spawning a new thread and then failing to allocate stack space for it.  However, it's trying to allocate 192MB for it, which is quite a lot!  Since Skype is a 32-bit application, total stack space will be limited.  Sure enough that user had:

  limit stacksize 192 megabytes

in their .cshrc file, a leftover from many years ago.  Removing that solved the problem.