tracker issue : CF-3144881

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

wsPublish() errors when used from within a Java Concurrency Framework Executor

| View in Tracker

Status/Resolution/Reason: To Fix//Investigate

Reporter/Name(from Bugbase): marc esher / marc esher (marcesher)

Created: 03/22/2012

Components: Web Socket

Versions: 10.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: Public Beta /

Priority/Frequency: Normal / Unknown

Locale/System: English / Windows 7

Vote Count: 0

NOTE: this is a copy of bug 3143790 in the prerelease forum

Problem Description:

Dave Ferguson posted an example of using websockets and CFThread to build a web-based log reader. It's described and downloadable here:

Dave's implementation spawns a new thread that lives forever, and he had to write some nasty workarounds to get it working. I talked to Dave about it and suggested that an improved version could be written without CFThread, and by using the Java Concurrency Framework and a ScheduledThreadPoolExecutor. 

This would also be a nice showcase of the new createDynamicProxy() feature in Zeus as well.

I create an instance of a component that has  a "run" method.  That method will read a log file and call wsPublish() for each line.

I then create a "proxy" for that component using createDynamicProxy();

I then submit that proxy to the ScheduledThreadPoolExecutor, which will call the "run" method every second.

Now, if I call the proxy's run method directly, i.e. not inside the executor, it works fine and wsPublish() is successful. However, when the executor calls it -- on its internal timer -- I get "Channel XXXX doesn't exist or is not running".

I obviously do not know the internals of how websockets work on the server, but I assumed that if it worked in cfthread, which continues to run after the browser request ends, then it should also work in the executor.

Thanks for checking this out, because I think the result using the executor would be much cleaner code, and would also showcase another great feature of Zeus (createDynamicProxy())!

Steps to Reproduce:

Open up components/LogConnectionManager.cfc and go to the startConnection() method. This is the code that creates an instance of LogPublisher and submits that to the executor.

unzip the attached zip file into the webroot

open up http://localhost:8500/logWatcher

From the file selection menu, choose a log file. it should be a small one

Actual Result:

The direct call to works; subsequent calls from within the executor fail with the message above

Expected Result:

I'd expect that the wsPublish() calls would succeed when run from within the executor

Any Workarounds:  None.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3144881

External Customer Info:
External Company:  
External Customer Name: marcesher
External Customer Email:  
External Test Config: My Hardware and Environment details:


  1. March 22, 2012 00:00:00: