After submitting the create ipaper form, this text appears:

iPaper [my paper title] has been created"
Preparing document...
This can take a while, depending on the size of your upload.

It sits there for about 10 seconds and then the page turns entirely white. The URL remains example.com/ipaper_upload/10
If I navigate back to the homepage, I find that the paper actually does upload. However, no thumbnail is generated for it.
Instead, the link border for the thumbnail collapses into a blue vertical line next to the paper title and description.
I'm running iPaper 6.x-1.0-rc7. on D6-10.

Any help would be appreciated. Thank you.

Comments

grasmash’s picture

I did a bit of investigating to see just where things go wrong.

The screen turns white as soon as function ipaper_upload($node) is called. It still performs the function though. It sits at the white page with an hourglass as the while ($stat != "DONE") loop runs. Once finished, the page just stays on the white screen. Somehow the drupal_goto("node/$node->nid") redirect is not working.

The paper does upload though! I just have to manually direct the browser away from /ipaper_upload/$node->nid to see it. Why would this happen?

rares’s picture

Do you have anything in the logs about the process taking too long? About how much do you wait until you get the blank screen? Have you tried other documents or file formats?

grasmash’s picture

Thank you for your response.

The upload screen is visible for about 3 seconds before it turns white. I have tried both .doc and .rtf formats. There are no messages in the PHP error log. The PHP max execution time is set to 45 seconds. I tried using: drupal_set_html_head('<meta http-equiv="Refresh" content="0;URL='. $node->nid.'">'); instead of drupal_goto("node/$node->nid"); , but that has no effect either. It's almost as if the drupal framework crashes while the upload function continues to run.

I've disabled every third party and non essential module and also increased the memory limit to 96mb, but the problem persists.

I've implemented a very primitive workaround for the moment:
By adding: echo "Please wait while your file is uploading..."; before the while loop,
adding: echo "..."; to the loop
and adding:

  echo "You will now be redirect to view your paper. <br /> \n";
  echo "If you are not redirected within 5 seconds, <br /> \n";
  echo "Please <a href='../node/".$node->nid."'>click here</a>.";
  echo '<script language="Javascript">';
  echo 'window.location="../node/'.$node->nid.'"';
  echo '</script>';

after the loop, I at least now have a message, indication of progress, and forced redirect.

However, I'd like to solve this problem correctly, as my solution does not look very professional.

I would appreciate any help that you could offer. Thank you!

rares’s picture

can you enable logging from the module configuration page ('log all requests.."), try a new upload, and then post what the logs say?
I am interested how far the code gets. I assume there will be docs.upload, but then do you also have docs.changesettings, getconversionstatus, and getdownloadurl following immediately after? if you upload a larger file (>150kb) the conversion should take a while and you will get several getconversionstatus requests

grasmash’s picture

Just to let you know, I installed the new version and the problem persists.

There are a number of ipaper entries in the log, as well as a few php errors from the dblog.

ipaper	03/18/2009 - 21:17	Action: docs.getDownloadURL, Document ID: ...	example
ipaper	03/18/2009 - 21:17	Action: docs.getConversionStatus, Document ...	example
ipaper	03/18/2009 - 21:17	Action: docs.getConversionStatus, Document ...	example
ipaper	03/18/2009 - 21:17	Action: docs.getConversionStatus, Document ...	example
ipaper	03/18/2009 - 21:17	Action: docs.getConversionStatus, Document ...   example
ipaper	03/18/2009 - 21:17	Action: docs.getConversionStatus, Document ...	example
ipaper	03/18/2009 - 21:17	Action: docs.getConversionStatus, Document ...	example
ipaper	03/18/2009 - 21:17	Action: docs.getConversionStatus, Document ...	example	
ipaper	03/18/2009 - 21:17	Action: docs.changeSettings, Document ID: ...	example
ipaper	03/18/2009 - 21:17	Action: docs.upload, Document ID: ... example	
content	03/18/2009 - 21:17	ipaper: added Log Test.	example	view
locale	03/18/2009 - 21:17	Parsed JavaScript file misc/textarea.js.	example	
locale	03/18/2009 - 21:17	Parsed JavaScript file misc/autocomplete.js.	example	
locale	03/18/2009 - 21:17	Parsed JavaScript file misc/progress.js.	example
locale	03/18/2009 - 21:17	Parsed JavaScript file misc/ahah.js.	example	
locale	03/18/2009 - 21:17	Parsed JavaScript file misc/jquery.form.js.	example
locale	03/18/2009 - 21:17	Parsed JavaScript file ...	example
locale	03/18/2009 - 21:17	Parsed JavaScript file misc/tabledrag.js.	example	
error	php	03/18/2009 - 21:08	unserialize() [<a ...	example	
error	php	03/18/2009 - 21:08	unserialize() [<a ...	example	
error	php	03/18/2009 - 21:08	unserialize() [<a ...	example	
error	php	03/18/2009 - 21:08	unserialize() [<a ...	example
error	php	03/18/2009 - 21:08	unserialize() [<a ...	example	
error	php	03/18/2009 - 21:08	unserialize() [<a ...	example
error	php	03/18/2009 - 21:08	unserialize() [<a ...	example	
error	php	03/18/2009 - 21:08	unserialize() [<a ...	example

I'm not sure if it's related, but the unserialize error is repeated a number of times, so, here are the details about that error:

warning: unserialize() [function.unserialize]: Node no longer exists in /home/paperp2p/public_html/modules/dblog/dblog.admin.inc on line 251.

Thanks for your help!

rares’s picture

I have just committed a patch that fixes the unserialize issue (log messages generated after you install the latest -dev version or make the changes below should not come with these errors, but older messages will still have the error).
If anyone else developing anything comes across this, see http://drupal.org/node/199337
In the case of this module, the changes had to do with the following section in ipaper_upload()

    $node->doc_id = $res->doc_id;
    $node->access_key = $res->access_key;
    $node->secret_password = $res->secret_password;

This should instead be:

    $node->doc_id = (string) $res->doc_id;
    $node->access_key = (string) $res->access_key;
    $node->secret_password = (string) $res->secret_password;

More on the redirect issue later.

rares’s picture

I've read through the code again and I don't understand why it might be crashing.
I'd like to ask you:
- What browser are you using?
- If you use firefox, can you install the Live HTTP headers module and have it track what requests are happening beginning with /ipaper_transfer/node-id? That should be followed by /ipaper_upload/node-id and then the path to your new node. What happens instead? Can you paste the output from the addon window? Do this with the original code (no hack)
- Can you try replacing the very last line in ipaper_upload ( drupal_goto("node/$node->nid"); ) with return url("Test"); Does a page with a link to your new node appear now when you upload?
- I have had this problem before on various pages and I am inclined to say that it has to do peculiar text file encodings in your php/inc files. I use Windows and I sometimes put a funny character like â in a php file and it will lead to this strange behavior. I would recommend backing up your code and replacing all hacked files on your server with the originals. You should also disable modules that you have tested on your site previously. That might solve it.

grasmash’s picture

First of all, let me thank you for putting so much time into solving my particular issue. I really appreciate it.

I'm using FireFox 3.0.7 on OSX 10.5.6

I've applied the patch that you posted and also installed the Live HTTP headers addon to firefox. Here is the output when uploading an ipaper

http://example.com/upload

POST /upload HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://example.com/upload
Cookie: BX=3o79v0h4qduqe&b=3&s=m5; SESSbc3a1b56ff3a5b4fe06d9d23f3207b38=14171138796d1306d3eb580ed142bbed; SESS4985de280be9f68b723eb913aeb025aa=78bbef21c9ed90d1e1a57d6f8db8f9f8; __utma=1.2038396942.1236969521.1237404795.1237410242.9; __utmz=1.1236969521.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); has_js=1; __utmc=1
Content-Type: multipart/form-data; boundary=---------------------------10102754414578508781458777923
Content-Length: 3791
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="title"

Test 
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="body"

Lorem Ispum test this is a description please work. Wow I need more words.
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="taxonomy[2][]"

2
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="taxonomy[4]"

880
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="taxonomy[tags][3]"

test
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="menu[link_title]"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="menu[parent]"

primary-links:0
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="menu[weight]"

0
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="license"

by-sa
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="private"

private
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="secret_password"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="doc_id"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="access_key"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="fid"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="changed"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="form_build_id"

form-ab36e87e92e0326dfa45fe02f4c0a321
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="form_token"

e9f8200b27d1463a5f21b1182cc34c4a
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="form_id"

ipaper_node_form
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="log"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="files[34][list]"

1
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="files[34][description]"

lorem_ipsum.doc
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="files[34][weight]"

0
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="files[upload]"; filename=""
Content-Type: application/octet-stream


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="pathauto_perform_alias"

1
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="path"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="comment"

2
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="name"

example
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="date"


-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="status"

1
-----------------------------10102754414578508781458777923
Content-Disposition: form-data; name="op"

Save
-----------------------------10102754414578508781458777923--

HTTP/1.x 302 Moved Temporarily
Date: Thu, 19 Mar 2009 00:50:08 GMT
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.4mm
Cache-Control: store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=1209600
Expires: Sun, 19 Nov 1978 05:00:00 GMT, Thu, 02 Apr 2009 00:50:08 GMT
X-Powered-By: PHP/5.2.5
Last-Modified: Thu, 19 Mar 2009 00:50:08 GMT
Location: http://example.com/ipaper_transfer/21
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
----------------------------------------------------------
http://example.com/ipaper_transfer/21

GET /ipaper_transfer/21 HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://example.com/upload
Cookie: BX=3o79v0h4qduqe&b=3&s=m5; SESSbc3a1b56ff3a5b4fe06d9d23f3207b38=14171138796d1306d3eb580ed142bbed; SESS4985de280be9f68b723eb913aeb025aa=78bbef21c9ed90d1e1a57d6f8db8f9f8; __utma=1.2038396942.1236969521.1237404795.1237410242.9; __utmz=1.1236969521.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); has_js=1; __utmc=1

HTTP/1.x 200 OK
Date: Thu, 19 Mar 2009 00:50:08 GMT
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.4mm
Cache-Control: store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=1209600
Expires: Sun, 19 Nov 1978 05:00:00 GMT, Thu, 02 Apr 2009 00:50:08 GMT
X-Powered-By: PHP/5.2.5
Last-Modified: Thu, 19 Mar 2009 00:50:09 GMT
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
----------------------------------------------------------
http://example.com/ipaper_upload/21

GET /ipaper_upload/21 HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: BX=3o79v0h4qduqe&b=3&s=m5; SESSbc3a1b56ff3a5b4fe06d9d23f3207b38=14171138796d1306d3eb580ed142bbed; SESS4985de280be9f68b723eb913aeb025aa=78bbef21c9ed90d1e1a57d6f8db8f9f8; __utma=1.2038396942.1236969521.1237404795.1237410242.9; __utmz=1.1236969521.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); has_js=1; __utmc=1

HTTP/1.x 200 OK
----------------------------------------------------------

Here also is the output in the event log. Notice that the PHP error is gone:

ipaper	03/19/2009 - 00:42	Action: docs.getDownloadURL, Document ID: ...	example	
	ipaper	03/19/2009 - 00:42	Action: docs.getConversionStatus, Document ...	example	
	ipaper	03/19/2009 - 00:42	Action: docs.getConversionStatus, Document ...	example	
	ipaper	03/19/2009 - 00:42	Action: docs.getConversionStatus, Document ...	example
	ipaper	03/19/2009 - 00:42	Action: docs.getConversionStatus, Document ...	example	
	ipaper	03/19/2009 - 00:42	Action: docs.getConversionStatus, Document ...	example
	ipaper	03/19/2009 - 00:42	Action: docs.getConversionStatus, Document ...	example
	ipaper	03/19/2009 - 00:42	Action: docs.getConversionStatus, Document ...	example
	ipaper	03/19/2009 - 00:42	Action: docs.getConversionStatus, Document ...	example
	ipaper	03/19/2009 - 00:42	Action: docs.changeSettings, Document ID: ...	example
	ipaper	03/19/2009 - 00:42	Action: docs.upload, Document ID: ...	example	
	content	03/19/2009 - 00:42	ipaper: added Lorem Test Again.	example	view
	locale	03/19/2009 - 00:40	Parsed JavaScript file misc/autocomplete.js.	example
	locale	03/19/2009 - 00:40	Parsed JavaScript file misc/progress.js.	example	
	locale	03/19/2009 - 00:40	Parsed JavaScript file misc/ahah.js.	example
	locale	03/19/2009 - 00:40	Parsed JavaScript file misc/jquery.form.js.	example
	locale	03/19/2009 - 00:40	Parsed JavaScript file ...	example

I actually haven't hacked any of the modules apart from yours, and that only in an attempt to workaround this issue. I've tried disabling all unnecessary modules but it has not had an effect.
I also tried switching the last line of the upload_ipaper() function and it does not display a link to the new upload's node. It seems that none of the drupal commands work once the screen has turned white.
I'll try disabling absolutely everything and even changing the theme, maybe that will solve it...

minesota’s picture

What is the memory limit in your php.ini ? If it is not 96mb raise it and see if the white screen still persists.

rares’s picture

maybe return url("node/$node->nid"); will do the trick.
edit: I mean, maybe it will get the link to show so that we know the issue rests with drupal_goto

grasmash’s picture

I've disabled every third party and non essential module and also increased the memory limit to 96mb. The PHP max execution time is set to 45 seconds.

rares’s picture

for the weird thumbnail the solution is to upgrade to rc8. or -dev

grasmash’s picture

return url("node/$node->nid"); does not display anything.

However, echo "node/$node->nid"; does print "node/11"; (correct nid);

So the nid is set. It's just that drupal commands (or displays for that matter) don't seem to be working.

grasmash’s picture

Upgraded to rc8. Thumbnails are working now. At least that's one problem down. You rock rares.

grasmash’s picture

Hmm.. I downloaded the entire site into a local MAMP environment and it all seems to work fine, so it must have something to do with the server environment.

I'm trying to cook up a better work around than a simple echo of "Please wait." I noticed that $text is set to equal a nice themed progress bar earlier.

I'd like to just include "return $text" at the beginning of the ipaper_upload() function so that it reloads the framework display after deciding to blink to a white screen.

The problem with that, of course, is that returning a value ends the function prematurely. Is there a way to force the browser to return $text again without ending the function?

If so, then I can just follow up with a javascript redirect and have a pretty looking workaround.

rares’s picture

try putting $_REQUEST['destination'] = "node/$node->nid"; instead of drupal_goto("node/$node->nid");

grasmash’s picture

Still no luck. I've resorted to having the module build a somewhat nice looking "waiting for your document to be converted to ipaper" page upon page crash, and using a javascript redirect.

rsvelko’s picture

usually it is the memory limit of PHP that causes whitescreens... 96MB should be ok for a moderate site .. try if setting it to 128/256 MB solves the problem - at least we should know if this fixes it ... and then try to see what happens...

ma_no’s picture

Just for information, my screen turns blank white with importing csv file with node import module.
(PHP memory limit it's set to 96mb).

rares’s picture

Could you please test if you are still having the same probiem with iPaper 6.x-1.0?