tracker issue : CF-4198405

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

Missing session scope after WSPublish

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Mike Begin / Mike Begin ()

Created: 03/14/2017

Components: Web Socket

Versions: 2016,11.0,2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: CF VERSION: 11,0,11,301867 / 303768 313649 313664

Priority/Frequency: Normal / All users will encounter

Locale/System: / Win 2012 Server x64

Vote Count: 0

Problem Description:

Invoking WSPublish causes the session scope to become inaccessible/undefined within any CFC methods that are called during the duration of the request (only CFC methods which run AFTER the call to WSPublish exhibit this behavior).  See example below which demonstrates the issue:

Steps to Reproduce:

--------------------------------------- test.cfm ---------------------------------------
<cfset sessionTest = CreateObject("component","test.test")>

<cfoutput> 
    #sessionTest.isSessionDefined()#  <!--- OUTPUT: YES --->
    <br>
    #IsDefined("session")# <!--- OUTPUT: YES --->
</cfoutput>

<cfset WSPublish("testChannel", "test")>

<cfoutput> 
    <br>
    #sessionTest.isSessionDefined()#  <!--- OUTPUT: NO --->
    <br>
    #IsDefined("session")# <!--- OUTPUT: YES --->
</cfoutput>
--------------------------------------- test.cfc ---------------------------------------
<cfcomponent displayname="test" output="false" hint="">

    <cffunction name="isSessionDefined" output="false" returntype="boolean" hint="">
        <cfreturn IsDefined("session")>
    </cffunction>
    
</cfcomponent>

Expected Result:

Session scope should not be effected by WSPublish

Any Workarounds:

Wrap call to WSPublish inside a <cfthread>

Attachments:

Comments: