This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Possible resource leak


On 9.12.2014 16:30, Doug Lewan wrote:
Petr,

You write:
-----Original Message-----
Subject: Possible resource leak

I'm dealing with possible resource leak in cygwin on Windows-7. I'm
running a script which repeatedly calls another script (every 5
seconds). After a while script ends with memory error. All my memory
seems to be eaten by Page Table entries and in the memory map I see a
lot of cygwin processes with 4 pages allocated (I can provide
screenshot
if neccessary). Is this known issue?
A few questions come to mind.

Can you tell which processes are staying around?
Use CYGWIN's ps(1); Window's Task Manager is likely to show only bash.exe.

Nearly all. I see a lot (read thousands after some time) of bash.exe, wget.exe, date.exe and sleep.exe processes. The problem is that not ps or Task Manager shows anything. I had to use RamMap from sysinternals to display them, all of them seems to me just like process zombies (i.e. they have only one private page allocated and four pages in page table).

Are you sure that all of wget(1)'s resources have been freed
before it gets invoked again?
I'm not sure about that but i thought that all process resources should be freed before process exits or shortly after that, on my other machine I see some (read three or five) of these 'zombie' processes when I run my testing scripts.
It surely uses things (IP stack, IP connections for example) that the Windows kernel manages.
Similarly, sleep(1)'s main resource is interrupts, probably also eventually coming from the kernel.
Perhaps there's a lock you should check (or create).

You'll also be sleeping 0 seconds about every 5th cycle;
maybe you should sleep $(( RANDOM%5 + 1 )) to make sure some sleeping always happens.

This doesn't bother me so much. These sleeps are there only to not overload server on other side too much. Occasional back-to-back request should be OK.

Every call to fetchData.sh is another fork()/exec()
which has to re-establish the definitions of getFileNoCheck() and getFileCheck().
It might be better to put everything into main.sh.
To be hones at this time I do not care much about performance of this scripts (sleeps will make them really slow).

Just some quick thoughts. It's always possible that there is something deep and subtle
inside the CYGWIN DLL happening. (But I doubt it.)
Or may be in my environment. In another reply I was told that sometimes antivirus programs can cause similar behavior. I will test my scripts on another Win7 machines.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]