On 20/05/2020 17:01, James Read wrote:
On Wed, May 20, 2020 at 2:31 PM Tom Hughes <t...@compton.nu
<mailto:t...@compton.nu>> wrote:
On 20/05/2020 14:23, James Read wrote:
> I'm trying to use valgrind to track down a memory leak in my web
> crawling application. The problem is my application runs just fine
> without valgrind but when I run it under valgrind the program
crashes
> before it has a chance to crawl any websites. Any ideas why this
> behaviour could happen?
On the basis of the information supplied I'd say it was
caused by excess neutron flux in the discombobulator.
Seriously, if you want anybody to actually try and answer
your question then you'll have to provide some actual
information like, what exactly it says...
A typical run of my program gives the following output:
Redis server: :0
Mongo server: 127.0.0.1:27017 <http://127.0.0.1:27017>
URL file: links/links-2
Max connections: 1000
Selected JUST CRAWLER MODE
Parsed sites: 132 ^C
Crawler thread exiting.
Exiting.
But with valgrind ./crawler -c I get the following output:
==415433== Memcheck, a memory error detector
==415433== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==415433== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright
info
==415433== Command: ./crawler -c
==415433==
Redis server: :0
Mongo server: 127.0.0.1:27017 <http://127.0.0.1:27017>
URL file: links/links-2
Max connections: 1000
Selected JUST CRAWLER MODE
==415433== Warning: ignored attempt to set SIGKILL handler in sigaction();
==415433== the SIGKILL signal is uncatchable
setrlimit() failed
==415433==
==415433== HEAP SUMMARY:
==415433== in use at exit: 37,773 bytes in 92 blocks
==415433== total heap usage: 6,112 allocs, 6,020 frees, 460,106 bytes
allocated
==415433==
==415433== LEAK SUMMARY:
==415433== definitely lost: 0 bytes in 0 blocks
==415433== indirectly lost: 0 bytes in 0 blocks
==415433== possibly lost: 0 bytes in 0 blocks
==415433== still reachable: 37,773 bytes in 92 blocks
==415433== suppressed: 0 bytes in 0 blocks
==415433== Rerun with --leak-check=full to see details of leaked memory
==415433==
==415433== For lists of detected and suppressed errors, rerun with: -s
==415433== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
As you can see no Parsed sites: value message just crashes and burns.
I don't see any crash there, just a program that has chosen to exit.
Does your code exit when setrlimit fails? What sort of limit is it
trying to set? My guess is that it's trying to play with RLIMIT_NOFILE
in a way that would encroach on valgrind's reserved descriptors so
valgrind is refusing the request and your program is then chooding
to exist rather than continue.
Tom
--
Tom Hughes (t...@compton.nu)
http://compton.nu/
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users