Thread: CF9 "Hang"

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    67
    Rep Power
    5

    CF9 "Hang"


    My flash program uses a CFC to form an email and a PDF attachment and then sends it via CFMAIL. On my test system, this works fine but the production system is having problems such that the CFC never returns to the Flash program. By inserting various CFLOG statements in the CFC, it would seem that it hangs in the PDF creation phase. I tried simplifying the PDF to a couple of lines but to no avail. Then, I re-started the CF Server and was able to send an email, in original format, but only one. I had to re-start CF in order to send another and so on. There are many web examples of people having similar issues but none of their solutions have so far helped.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,277
    Rep Power
    968
    I'd start by looking at the web server and CF logs on the production system. If that reveals nothing, thoroughly compare everything you can between your test system setup and the production system setup. That means all CF administrator settings, JVM settings, IIS/Apache settings, Windows settings/RAM/memory, version numbers and patch level on CF/IIS/Apache/Windows, and so on. If it works on test but not on production, then something must be different between the two.
    Last edited by kiteless; January 25th, 2013 at 08:17 AM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    67
    Rep Power
    5
    kiteless - again, thanks. Lots of comparison checking, as per your advice, and experimentation on the server has shown that the problem is definitely in the pdf creation (cfdocument). The server is SBS2008 whilst my test box is XP and the application does not use a browser. Flash talks to coldfusion which has the db (mySQL) attached. Flash calls a CFC SENDeMAIL which invokes another CFC called CREATEPDF which creates the PDF and puts it in a variable which is passed back to SENDeMAIL to be an attachment to CFMAIL. If I don't do CREATEPDF, the simple email always sends. If I attach a previously created PDF, the email sends. It's only when I use CREATEPDF that I get a problem. It seems that SBS2008 is doing something differently. I restart CF and I can send the email with the CREATEPDF attachment but if I then try to send it again, it "hangs" in CREATEPDF requiring a CF restart. It's like CF has been corrupted in someway.
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,277
    Rep Power
    968
    It's possible...it's also possible that the code that's creating the PDF is doing something that is screwing things up for subsequent attempts to create the PDF.

    It always helps in cases like this to try and create a web-based test page that will call your CFC. That way you can test things more easily, use cfdump to view debug output, etc.
  8. #5
  9. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,277
    Rep Power
    968
    Also, it obviously goes without saying that you really should try to mirror the production environment when you test. An easy way to do this is use something like VMWare Workstation to set up a local virtual machine running SBS 2008.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    67
    Rep Power
    5
    kiteless, as ever you make good points. A further difference between the test and production environments is that production has a purchased copy of CF9 whilst test has a developer version.

    I've been at this all day. Eventually, I created a small Flash program which I run in the browser and it calls my CREATEPDF cfc to create a 1 line pdf and save it in cf9's wwwroot/cfc folder. This works perfectly in test but in production it "hangs" on the CFDOCUMENT statement. How to debug this further? Is there some sort of trace I can use?

    UPDATE: When we create a PDF "in memory", does it write a file, albeit temporary? It occurs to me that this may be the first time that I've used CF to write a file.
    Last edited by new2cfrb; January 29th, 2013 at 07:38 AM.
  12. #7
  13. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,277
    Rep Power
    968
    It may write a temporary file automatically to CF's temp directory, but I'm not sure why that would matter unless you think it's a permissions issue?
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    67
    Rep Power
    5
    I guess there is a lot of clutching at straws. I did find well documented examples of my exact problem being experienced in cf7 but nothing later. I have borrowed an sbs2003 server on which I can experiment further but I'm not sure I can install sbs2008.

    The cfc which fails is a very simple "in memory" model:

    Code:
    <cffunction name="createAndSavePDF" access="remote" output="yes">         
    <cflog text="createAndSavePDF: Starting cfsavecontent!">         
    <cfsavecontent variable="doc"> 			
    <p>This is a test</p> 		
    </cfsavecontent>         
    <cflog text="createAndSavePDF: Starting cfdocument!">         
    <cfdocument format="pdf" filename="poPDF.pdf" overwrite="yes">             
    <cfoutput>#doc#</cfoutput>         
    </cfdocument>         
    <cflog text="createAndSavePDF: Finished!">         
    <cfset replyStruct.status = "ALLOK">         
    <cfreturn replyStruct>     
    </cffunction>
    I see the first 2 log outputs but not the third and there seems to be no excessive cpu consumption.
  16. #9
  17. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,277
    Rep Power
    968
    Have you checked the CF server logs to see if any errors have been logged? You could also try wrapping the cfdocument tag in a try/catch block and log any errors.
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    67
    Rep Power
    5
    kiteless: Yes, logs checked and I had the try/catch there but to no avail because it never failed - just "hung". Setting up my test server was not going to be quick so, short of time and with production stalled, I had to find a workaround and I did. A rapid "learning" phase and I created a workable, though far from perfect, CFSCRIPT containing iText commands. Users can now create and email PDF's which can be printed by the recipient. There is a downside though and please tell me if this should be a separate thread. To print the PDF, the CFC uses CFPRINT but CF9 won't pick up the default printer. So, I specify a printer in the CFPRINT but this printer is not installed on this machine as there is no 64bit driver, so it's shared from another computer - CF9 doesn't pick it up in it's list of printers and the command fails rather badly.

    I'll close this and open a new thread.
    Last edited by new2cfrb; February 4th, 2013 at 10:37 PM.
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    67
    Rep Power
    5

    Solved!


    Since updating to Java 1.6.0_38, cfprint no longer hangs.
  22. #12
  23. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,277
    Rep Power
    968
    Great, even though that SEEMS to me like something else was going on then. CF 9 came out way before Java 6 u38, so I can't imagine there is something "magic" in that particular Java update that fixes a CF issue.
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    67
    Rep Power
    5
    kiteless, my feelings exactly, it's been working on xp under 1.6.0_16 for a while. Yes, the server has a very different software environment but....how far do I take this? I'd really like to find the cause but...got to get on...other challenges, etc.

    Thank you for your assistance and patience.

IMN logo majestic logo threadwatch logo seochat tools logo