CARLI / web-reports

Web Reports Web Based Reporting Tool
2 stars 0 forks source link

Report system filename starts with whitespace #119

Open patrickzurek opened 7 years ago

patrickzurek commented 7 years ago

Making a quick issue for this so I can return to it later. It looks like there's a report with a filename beginning with a single whitespace character:

pzurek@web-reports-devel:~/web-reports/reports/system_administration/circulation$ stat \ circ_policy_definition_patrons_tab.report File: ‘ circ_policy_definition_patrons_tab.report’ Size: 9279 Blocks: 24 IO Block: 4096 regular file Device: 803h/2051d Inode: 523986 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 33/www-data) Gid: ( 33/www-data) Access: 2017-01-30 06:25:57.895505101 -0600 Modify: 2017-01-23 10:27:26.188354704 -0600 Change: 2017-01-23 10:27:26.188354704 -0600 Birth: -

/home/pzurek/web-reports/reports/system_administration/circulation

dmcmpbll commented 7 years ago

Ah! That might be a reason why I was getting strange error messages when I tried to run it last week or week before. Sorry about that!

patrickzurek commented 7 years ago

I checked in admin's filebrowser and the filename is flush with the left margin. There's no way you could tell it had a whitespace since the filebrowser web app isn't displaying it. I just happened to notice it while using the Linux command line to move a different report to prod.

patrickzurek commented 7 years ago

Since the file wasn't tracked by git, I simply used the Linux shell's mv command to change the filename:
$sudo mv \ circ_policy_definition_patrons_tab.report "circ_policy_definition_patrons_tab.report"

The "\" right after mv is necessary to escape the whitespace at the beginning of the filename.

Try it again, it should work now.

Edit: and the quotation marks around the second argument to mv weren't necessary by me either..

dmcmpbll commented 7 years ago

Since you removed the blank space in the file name for me, I ran the query for SFM.

The Results say that it should have 13 rows, but when I tried to view them, I got an AJAX error that referred me to this webpage: https://datatables.net/manual/tech-notes/7

The CSV file for the results downloaded and opened without issue.

ajaxerror

I am using Chrome, my result number is 544080c2 created Feb. 21, 2017, 12:56 PM

patrickzurek commented 7 years ago

The following update contains a handful of unnecessary details. tl;dr is: I looked into the problem a little bit and it doesn't seem like it's going to be a super fast fix. I'll return to it when I have more time to focus on it.

Look at this really long URL Web Reports is trying to access:

### https://web-reports-devel.carli.illinois.edu/output/ss_results/6bccc3ca-3b34-4f55-93e3-60585551ccd4?draw=1&columns%5B0%5D%5Bdata%5D=0&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=1&columns%5B1%5D%5Bname%5D=&columns%5B1%5D%5Bsearchable%5D=true&columns%5B1%5D%5Borderable%5D=true&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B2%5D%5Bdata%5D=2&columns%5B2%5D%5Bname%5D=&columns%5B2%5D%5Bsearchable%5D%5Bregex%5D=false&columns%5B40%5D%5Bdata%5D=40&columns

~40-80 lines snipped (told you it's a really long URL)

e&columns%5B41%5D%5Borderable%5D=true&columns%5B41%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B41%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B42%5D%5Bdata%5D=42&columns%5B42%5D%5Bname%5D=&columns%5B42%5D%5Bsearchable%5D=true&columns%5B42%5D%5Borderable%5D=true&columns%5B42%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B42%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B43%5D%5Bdata%5D=43&columns%5B43%5D%5Bname%5D=&columns%5B43%5D%5Bsearchable%5D=true&columns%5B43%5D%5Borderable%5D=true&columns%5B43%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B43%5D%5Bsearch%5D%5Bregex%5D=false&order%5B0%5D%5Bcolumn%5D=0&order%5B0%5D%5Bdir%5D=asc&start=0&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&_=1487784196467

So what's happening is Datatables makes a behind the scenes AJAX HTTP request to fetch the data for the table from the server. Is makes the request via a plain old HTTP URL to the server which happens to be our friendly neighborhood Apache web server.

Apache responds with a HTTP 414 error because it's obvious to even the most dimwitted web server process that the URL is just way too long:

Request-URI Too Long The requested URL's length exceeds the capacity limit for this server.

All that gibberish junk that is making the URL so long obviously seems correlated with the large number (44) of columns present in the report (is anyone aware of an instance of a report with a similarly large number of columns in the system?). Problem is, all that junk is being generated by Datatables, not my application code (well, not directly). So I can't directly influence what goes there short of simply reducing the total number of columns in the report.

I'm going to have to put this one on the back burner for a bit until I can return to it and spend more time on it. A simple fix is not immediately apparent to me.

bgant commented 7 years ago

Not a real fix, but it looks like you can just increase the size of allowed URL strings using "LimitRequestLine" in the Apache conf:

https://httpd.apache.org/docs/2.2/mod/core.html#limitrequestline