tracker issue : CF-4204037

select a category, or use search below
(searches all categories and all time range)
Title:

CFThread 100% Failure When Wrapping CFDocument

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Michael S. / ()

Created: 02/20/2019

Components: Tags, Page Processing

Versions: 2018

Failure Type: Non Functioning

Found In Build/Fixed In Build: 2018 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Win 2012 Server x64

Vote Count: 0

Problem Description:
Wrapping CFDocument with CFThread returns a null value and the code inside the thread does not appear to execute.

Steps to Reproduce:
<cfthread name="cfthreadTest_#dateFormat(NOW(),'mmddyyssss')#" action="run">	
	<cfdocument format="PDF">
             <cfdocumentitem type="header" evalatprint="true"> 
                 Some HTML Content
	     </cfdocumentitem> 
             <cfdocumentitem type="footer" evalatprint="true">
                 Some HTML Content
             </cfdocumentitem> 
             <cfdocumentsection name="bodyContent">
                  Some HTML Content  
             </cfdocumentsection>
     </cfdocument>
</cfthread>

Actual Result:
Produces the following error in the application log with a corresponding entry in the exception log. 
CFTHREADTEST_0220190055: null

Expected Result:
A pdf generated  in the browser window. When attempting to write the file to disk, I see the same behavior.

Any Workarounds:
I have found no workarounds yet.

Attachments:

Comments:

Hi ,   This is not an issue actually and has no relation with PMT as such.  As you can see in the code, CF document is running inside a thread and expecting to see the pdf result in the browser. As the request has already expired and pdf generation task is delegated to another thread, one can't see the pdf on the browser because response stream is already closed. Workaround for this is to write the pdf to a file and block the main thread till the pdf is generated at specified location. Then render the pdf on the browser using cfcontent tag and content disposition.   I propose below work around using runAsynch feature. And will add a comment in the bug.   <cffunction name="generatepdf">      <cfdocument format="PDF" filename="C:\ColdFusion2018\cfusion\wwwroot\pdftest\test.pdf" overwrite="true" >      <cfdocumentitem type="header" evalatprint="true">      Some HTML Content      </cfdocumentitem>      <cfdocumentitem type="footer" evalatprint="true">      Some HTML Content      </cfdocumentitem>      <cfdocumentsection name="bodyContent">      Some HTML Content      </cfdocumentsection>      </cfdocument> </cffunction>   <cffunction name="writeBrowser">      <cfcontent type = "application/pdf" file ="C:\ColdFusion2018\cfusion\wwwroot\pdftest\test.pdf" deleteFile = "no"> </cffunction>     <cfscript>      future  = runAsync(generatepdf).then(writeBrowser);      future.get(); </cfscript>
Comment by Mayur J.
30347 | February 20, 2019 02:52:37 PM GMT
Sorry, you are right. I posted the wrong sample code. I'll submit a different bug report.
Comment by Michael S.
30348 | February 20, 2019 03:50:38 PM GMT
Hi Mike, Let us know when you create another bug report for the issue you are facing. In the mean time we will close this bug. Thanks, Mayur Jain
Comment by Mayur J.
30386 | February 25, 2019 06:17:38 AM GMT
As discussed with the User, he will be submitting a different bug with correct code. Closing this for now.
Comment by Kailash B.
30387 | February 25, 2019 06:37:35 AM GMT