last day (15 days later) » 

10:48 PM
1
Q: Why is this XMLHTTPRequest aborted before going to the server?

BrianSI maintain a web app that uses CKeditor in conjunction with simogeo Filemanager. At some point (I am, unfortunately, not sure when) the file upload functionality stopped working. It's not a server code issue (at least not directly) because the XHR request is never sent to the server. Beyond that,...

 
All the code is wrapped up into the Filemanager package. I just set a few configuration options, which are the same between the two systems.
I did (once I tracked down where the AJAX configuration object was being set). It caused Firefox to throw a JS error: TypeError: b is null.
Also of note, this only appears to happen if I'm doing a file upload. Normal form data is POSTed via AJAX just fine.
Ok, so I simplified the problem by utilizing the following code: github.com/New-Bamboo/example-ajax-upload. The request is still being killed before being sent to the server, while a nearly identical server shows no issues.
Made significant changes to cover what I've done and what I know.
@user2864740 one of these days someone will propose a solution so simple, so obvious, that I would have to turn in my keyboard. This was not it. But thanks, because I hadn't yet tried that one.
 
what is sitting on the other end of your test script? Is it supposed to return the contents of the file on success? or does index.php simply spit back the test page regardless of request type?
 
@Emissary when you submit the form it returns the name of the file you submitted. You can see a functional version here: eclecticgeek.com/bugs/fileup
 
Okay, I was sitting playing around with it but can't for the life of me see anything wrong - sorry if I'm making you reiterate stuff but the fact that the same script works on a different domain screams server issue to me. When you say the request is never sent to the server how are you determining that? - it's not necessarily going to be obvious from a browser debugger.
I'll tell you what I think is happening, your working version is running on a standard Apache/PHP setup - happy days. Your broken version is running on some kind of FastCGI/suPHP option etc. (I'm not really clued up on the nuances between them) but in some setups when a PHP script fails it just kills the process - i.e. no response at all (inc. headers). Have you tried enabling PHP errors for debugging? If I were a betting man - and I am - my money is on either a simple permissions or chmod issue.
 
I think you have the broken vs. working platforms backwards. The broken one is on Apache w/ modphp. No doubt it's a server issue, but I can't figure out what. However, it's not the general software configuration because I have a private server that is almost identically configured that does not exhibit the same behavior. Definitely something with that server ... I just can't figure out what.
 
10:48 PM
hi
 
Hello :)
 
modphp != standard setup either
you can count that under etc.
 
OK, yes that is true.
So, I know it's not hitting the server based on both the HTTP and PHP logs. Plus, Firebug is indicating the request has been aborted, sometimes in as low as 0ms.
So the browser, for some reason, is killing the request.
I'm guessing maybe it's related to cross-domain security ... even though this particular request is not going to a different domain. But that's really tilting at windmills for an explanation.
 
I'm still not convinced - it's all in the same index.php file right? and that is serving the test script fine. the javascript is irrelevant because if you just let the form submit as a standard HTML form you don't get a response from the server either
if the PHP script is failing - it's not guaranteed to write to logs server side
and just because you don't get a response header in a browser doesn't mean the request wasnt sent
have you tried enabling the PHP error output?
 
yes, but apache isn't logging anything either ... I realize none of this means the request isn't being sent, but it's tilting heavily towards that being the case.
 
10:57 PM
ye not even error logging - simply the htaccess directives that enable PHP to spit out errors in the response body
admittedly I'm not sure how exactly they go in modPHP - googling that just now
but I'm pretty much convinced it's not a client-side issue.
 
know linux shell very well?
 
intermediate
I dare not say expert ;)
there's so much to learn
not sure where you going with that? but I can have a look around - if you don't want to give out passwords I can easily pass you my public ssh key
 
11:11 PM
ok, you're right. Using tcpdump I can see something going on
the short life of the request must just be due to proximity
so something's killing the request
but only to php
 
(and the significantly small amount of data sent)
 
if I change the destination to an HTML file it goes through ok
 
are you getting error messages though? If it's just a simple script you have for testing purposes I can't see it been much more than permissions
is the /tmp dir configured correctly?
 
should be /tmp, which seems to be writing fine for other actions
Could it be suhosin?
 
not sure - I've never had to use it
is there any custom configuration?
or is everything just standard install?
 
11:22 PM
There's some customization, but not a lot.
I'm getting ready to look at some more log files. Maybe I missed something.
 
different approaches :P
I'd be commenting stuff in the PHP file line by line until I'm absolutely sure it can't be any particular piece of PHP functionality
 
I'll get there eventually. But if the system is screaming at me and I didn't notice it I'll feel like a fool.
I'm already ahead of where I was. I was positive it was a client issue.
 
My guess is that if it were related to something else on the server you'd have had more logs to sift through
Definitely server-side. It makes no sense that code would just work in the same browser environment on one server and not another
 
That's what I was thinking originally, but then I couldn't find any reasonable explanation and ... well ... guess I just lost my head
It's the identical private server that really throws me off. Those two should have nearly the same configuration.
oh, snap ... segmentation fault in php on file upload
that's why no PHP errors
 
i see
now I'm not totally convinced it's a code issue.
haha
 
11:33 PM
;) actually, I guess not necessarily in PHP ... that's just a guess, segfault is in the apache child process
 
I see
could just be a generic error
 
but it seems likely to be PHP-related since I can post an image to HTML
 
still worth going through the index.php file and commenting out stuff
specifically the code that attempts to read from the tmp directory
and if that works the bit that attempts to copy it to another part of the file system?
 
so close now ...
 
I'm afraid I'm really not too familiar with modPHP but if it's anything like suPHP it needs very specific directory permissions
something like chmod 644 on directories or it will choke
and I think 755 for files
php files that is
actually that's totally the wrong way round
755 for folder
man long day
 
11:41 PM
tell me about it
wow ... server uptime of 90 days
hate to break it, but maybe a restart will flush out some bad mojo
O. M. G.
!!!
I hate myself
 
go on...
 
restarted apache ... all is well
that's not supposed to happen
 
I don't believe you :P
 
go and post something ... you deserve a cookie
I was so focused on a client issue I started ignoring the server. You put me back on the right path.
 
no I'm not taking credit for that if that's what it was
 
11:46 PM
Hey, my 50 rep are gone either way. You deserve some of it.
Sometimes you just need somebody to bounce ideas off of
I swear I've never seen that work with linux/apache
 
me neither very odd. Only time that's helped me was with a corrupt mysql database but that's a different issue.
okay how can I at least link to chat so theres a log of this?
 
been there, too :/
of course
 
50 rep will net some short term points but lose me rep in down votes if there's no explanation lol
gimme a few minutes to go through and star all the useful comments so it's actually a useful log :)
 
That's true. I don't want it to hurt you. But you deserve something.
 
ah can you star any of my posts vaguely relevant to the issue - I can't highlight my own
 
11:55 PM
I noticed that. Looking through to see which ones set me on the right path
 
ok mate, glad you're sorted - I have to shoot, bed time on this side of the atlantic ;)
 
No worries. Thanks for hangin'
 

last day (15 days later) »