Bug 227328 - Please increase VG_N_THREADS slightly
Summary: Please increase VG_N_THREADS slightly
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.6 SVN
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-17 10:10 UTC by lool@dooz.org
Modified: 2010-02-22 11:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lool@dooz.org 2010-02-17 10:10:49 UTC
Hi there,

Andriy Lesyuk <s-andy@in.if.ua> reported in Debian bug http://bugs.debian.org/514133 that he was hitting the VG_N_THREADS limit with his app:
"""
Having an application running more than 300 threads. Sometimes (not
always for some reason) when running in valgrind I get:

vg_alloc_ThreadState: no free slots available
Increase VG_N_THREADS, rebuild and try again.

valgrind: the 'impossible' happened:
   VG_N_THREADS is too low
==28559==    at 0x3801A41D: report_and_quit (m_libcassert.c:140)
==28559==    by 0x3801A52B: panic (m_libcassert.c:210)
==28559==    by 0x3801A5C2: vgPlain_core_panic_at (m_libcassert.c:215)
==28559==    by 0x3801A600: vgPlain_core_panic (m_libcassert.c:220)
==28559==    by 0x38036F33: vgPlain_alloc_ThreadState (scheduler.c:187)
==28559==    by 0x38078E0A: vgSysWrap_x86_linux_sys_clone_before
(syswrap-x86-linux.c:212)
==28559==    by 0x3803A600: vgPlain_client_syscall (syswrap-main.c:850)
==28559==    by 0x38037768: handle_syscall (scheduler.c:790)
==28559==    by 0x380386FE: vgPlain_scheduler (scheduler.c:984)
==28559==    by 0x3804D2D8: run_a_thread_NORETURN (syswrap-linux.c:89)
==28559==    by 0x3804D5A2: vgModuleLocal_start_thread_NORETURN
(syswrap-linux.c:212)
==28559==    by 0x38074D58: (within /usr/lib/valgrind/x86-linux/memcheck)
==28559==    by 0xA12FEFFE: ???
==28559==    by 0xA12ECFFF: ???
==28559==    by 0x734: ???

sched status:
  running_tid=3

It stopped on thread 299 :)

Can VG_N_THREADS be a little bit increased?
"""

Would you mind bumping it from 300 to 500 upstream?  Ideally, having that adjusted dynamically, or as a runtime override, or as a configure flag would be fine!

Thanks,
Comment 1 Konstantin Serebryany 2010-02-17 10:19:22 UTC
In our custom build of valgrind this limit is set to 5000. 
To compare: in PIN this limit is 2048, which is sometimes not enough for us! 

We also had to raise few other limits: see http://code.google.com/p/data-race-test/source/browse/trunk/valgrind_patches/limits.patch
Comment 2 Julian Seward 2010-02-22 11:31:26 UTC
Increased to 500.