jetty scanner NullPointerException - jetty

every buddy:
i'm so confused when i see this exception about jetty.
Exception in thread "Scanner-1" java.lang.NullPointerException
at org.eclipse.jetty.util.Scanner.scanFile(Scanner.java:576)
at org.eclipse.jetty.util.Scanner.scanFiles(Scanner.java:438)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:397)
at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:348)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Exception in thread "Scanner-0" java.lang.NullPointerException
at org.eclipse.jetty.util.Scanner.scanFile(Scanner.java:576)
at org.eclipse.jetty.util.Scanner.scanFiles(Scanner.java:438)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:397)
at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:348)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
and the source code about Scanner.java is:
// If it is a directory, scan if it is a known directory or the depth is OK.
573 if (f.isDirectory() && (depth<_scanDepth || _scanDepth==-1 ||
_scanDirs.contains(f)))
574 {
575 File[] files = f.listFiles();
576 for (int i=0;i<files.length;i++)
577 scanFile(files[i], scanInfoMap,depth+1);
578 }
579 }
how line 576 code occurs nullpointer exception?
jetty-version: 8.1.3.v20120416
need your guys help, 3q so mush.

On line 576, files is null, which implies f is null.
Please check if f is successfully instantiated.

I encountered this very same error recently. What I did was to set OS limit on the max number of files opened.
This can be set in /etc/security/limits.conf by adding the following lines:
* soft nofile 65536
* hard nofile 65536
and then rebooting the server.
The * means that this setting applies to all users. You can put in the specific user that you use to run the Jetty process. The value 65536 specifies the maximum number of files (nofile) that can be opened. The specifics of this setting can be found by looking at the limits.conf man page.

Related

How to fix RuntimeError & Segmentation fault while running demo codes in auto-07p

I was running demo codes in AUTO-07p, which is mainly based on fortran but also following python syntax, but I was getting same error when I run most of demo codes. Since they're not written by me, but written by experts and has been released for a long time, so there must NOT an error. Maybe I don't have to modify the codes.
So when I run codes containing either bifurcation analysis part or plotting, I kept getting an error message RuntimeError: maximum recursion depth exceeded while calling a Python object.
So, I tried to change recursion limit to 10^7, but then I got the error message "Segmentation fault (core dumped)
I'm using ubuntu 16.04 LTS
demo('bvp')
bvp =run('bvp')
branchpoints = bvp("BP")
for solution in branchpoints:
bp = load(solution,ISW=-1,NTST=50)
# Compute forwards
print "Solution label",bp["LAB"],"forwards"
fw = run(bp)
# Compute backwards
print "Solution lavel", bp["LAB"], "backwards"
bw = run(bp,DS='-')
both = fw + bw
merged = merge(both)
bvp = bvp + merged
bvp=relavel(bvp)
save(bvp, 'bvp')
plot(bvp)
wait()
The error message says (excluding seemingly unnecessary lines)
/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.pyc in flatnonzero(a)
924
925
-->926 return np.nonzero(np.ravel(a))[0]
927
928
... last 1 frames repeated, from the frame below ...
/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.pyc in flatnonzero(a)
924
925
-->926 return np.nonzero(np.ravel(a))[0]
927
928
RuntimeError: maximum recursion depth exceeded while calling a Python object
So it seems the code is stuck in an infinite loop, but that flatnonzero function is simply indexing nonzero entries... I'm not sure what should I do

"too many open files" error after deleting many files

My program creates a log file every 10 seconds in a specified directory. Then in a different thread, it iterates the files in that directory. If the file has content it compresses it and uploads it to external storage, if the file is empty, it deletes it. After the program runs for a while I get an error "too many open files" (gzopen failed, errno = 24).
When I looked inside /proc/<pid>/fd I see many broken links to files in the same directory where the logs are created and the word (deleted) next to the link.
Any idea what am I doing wrong? I checked the return values in both threads, of the close function (in the thread which writes the logs), and in the boost::filesystem::remove (the thread which compresses and uploads the non empty log files and deletes empty log files). All the return values are zero while the list of the (deleted) links gets longer buy 1 every 10 seconds.
I think this problem never happened to me on 32 bits but recently I moved to 64 bits and now I got this surprise.
You are neglecting to close files you open.
From your description, it sounds like you close the files you open for logging in your logging thread, but you go on to say that you just boost::filesystem::remove files after compressing and/or uploading.
Remember that:
Any compressed file you opened with gzopen has to be gzclosed
Any uncompressed file you open to compress it has to be closed.
If you open a file to check if it's empty, you have to close it.
If you open a file to transfer it, you have to close it.
Output of /proc/pid/fd would be very helpful in narrowing this down, but unfortunately you don't post it. Examples of how seemingly unhelpful output gives subtle hints:
# You forgot to gzclose the output file after compressing it
l-wx------ user group 64 Apr 9 10:17 43 -> /tmp/file.gz (deleted)
# You forgot to close the input file after compressing it
lr-x------ user group 64 Apr 9 10:17 43 -> /tmp/file (deleted)
# You forgot to close the input file after logging
l-wx------ user group 64 Apr 9 10:17 43 -> /tmp/file (deleted)
# You forgot to close the input file after transferring it
lr-x------ user group 64 Apr 9 10:17 43 -> /tmp/file.gz (deleted)

Warning: POST Content-Length of 140150966 bytes exceeds the limit of 104857600 bytes in Unknown on line 0

I get the above error in joomla 3.1.5 when i attempt to install a template from extension manager. I increased the upload limit but it dint solve my problem.
As well as increasing the upload_max_filesize, you also need to increase the post_max_size.
Try setting the post_max_size to something like 20M

Fatal Python error: Couldn't create autoTLSkey mapping with C++ binding

when trying to create a sub process from python binding, i have this error :
"Fatal Python error: Couldn't create autoTLSkey mapping"
If i just run the script from the terminal, there is no problem.
Does anyone have any informations about this ?
Thanks.
And for others not on 2.7.2 this could also be a memory limit issue. In my uwsgi settings file I had:
limit-as = 512
reload-on-as = 256
reload-on-rss = 192
But these were too low. So if you have a similar limit then increase them.

Stack Overflow exception (0xC00000FD) at winsock select function

I have an application which makes use of winsock.
I/O part is handled on an other thread.
And I am using blocking select method for sockets.
But the point is that after 5-6 hours,my application gives 0xC00000FD exception, at the line of select function.
As far as I know, this exception occurs when there is recursion, or very large local variables. But neither of them is the case for me.
So do you have any idea why am I getting this exception?
Or any ideas to discover what actually causes exception?
many thanks
EDIT 2:
Dear All, I am very sorry but since reproducing the case takes long time, I just realized that this has not solved the problem.
Everything seems ok when stack overflow exception occurs at the line of select function.
I mean it is a server socket with a one client connected. So there is 2 socket in rset and 1 in wset. After selecting, I am checking all ready sockets and making required, read,write,accept. Timeout is 250 ms. Do you think can this be the problem? I don't want this function to be blocking so it is not null. But what will be the exact difference if I use {0,0}
An important hint is:
Same code was working without any problem, when client socket wasn't sending any data.
But when I started sending some data from client to server this problem occured.
I am sure that there is no problem with FD_SETs and FD_CLRs, I mean when client was not sending only 1(server) socket was in rset and 1(client) was in wset.
Anyway I had a look a lot of samples, but it seems that there is not a difference.
Please see local variables screenshot below(I have deleted name of executable, since it is a commercial product)
http://img192.imageshack.us/img192/1948/stackoverflow.jpg
And here is the call stack:
ntdll.dll!7c90df3a()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
mswsock.dll!71a53c9c()
ntdll.dll!7c90d26c()
mswsock.dll!71a55f9f()
mswsock.dll!71a55974()
ws2_32.dll!71ab314f()
xyz.exe!vm_socket_select(vm_socket * hds=0x04c1fb84, int nhd=1, int masks=7) Line 230 + 0x1b bytes C
xyz.exe!ND::nd_socket::SocketThreadProc() Line 173 + 0x12 bytes C++
xyz.exe!ND::nd_socket::ThreadRoutineStarter(void * u=0x07d63f90) Line 332 C++
xyz.exe!_callthreadstartex() Line 348 + 0x6 bytes C
xyz.exe!_threadstartex(void * ptd=0x011a3ce8) Line 326 + 0x5 bytes C
kernel32.dll!7c80b713()
I am waiting for any advice.
Many thanks
Have you tried stopping your program in a debugger after some time running? Then take a look at the stack it might give you a hint.
Recursion doesn't mean one of your functions call itself endlessly, it can't be more tricky and involve several layers before it comes back where it started.