SKPHP1989 / phpws

Automatically exported from code.google.com/p/phpws
0 stars 0 forks source link

java.lang.AbstractMethodError: Unblocking keep-alive exception #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

We´re running an application under glassfish 3.1.1 and the grizzly 1.41 
libraries. We intend to use the php client: 
http://code.google.com/p/phpws/source/checkout , but getting the following 
error:  

SCHWERWIEGEND: GRIZZLY0041: Unblocking keep-alive exception.
java.lang.AbstractMethodError: 
com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectionKeyHandler$Close
Handler.remotelyClosed(Ljava/nio/channels/SelectionKey;)V
    at com.sun.grizzly.BaseSelectionKeyHandler.notifyRemotlyClose(BaseSelectionKeyHandler.java:233)
    at com.sun.grizzly.util.InputReader.doRead(InputReader.java:295)
    at com.sun.grizzly.util.InputReader.read(InputReader.java:206)
    at com.sun.grizzly.tcp.http11.InternalInputBuffer.fill(InternalInputBuffer.java:820)
    at com.sun.grizzly.tcp.http11.InternalInputBuffer.parseHeader(InternalInputBuffer.java:716)
    at com.sun.grizzly.tcp.http11.InternalInputBuffer.parseHeaders(InternalInputBuffer.java:602)
    at com.sun.grizzly.http.ProcessorTask.parseRequest(ProcessorTask.java:886)
    at com.sun.grizzly.arp.DefaultAsyncExecutor.preExecute(DefaultAsyncExecutor.java:124)
    at com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:88)
    at com.sun.grizzly.http.TaskBase.run(TaskBase.java:193)
    at com.sun.grizzly.http.TaskBase.execute(TaskBase.java:175)
    at com.sun.grizzly.arp.DefaultAsyncHandler.handle(DefaultAsyncHandler.java:145)
    at com.sun.grizzly.arp.AsyncProtocolFilter.execute(AsyncProtocolFilter.java:210)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:662)

Could you suggest something? Thanks in advance.

Original issue reported on code.google.com by mamta.hi...@googlemail.com on 30 Nov 2011 at 9:00

GoogleCodeExporter commented 8 years ago
To be honest, I don't know anything about Glassfish or Grizzly. Does it contain 
a WebSocket server?

Currently the phpws client is only tested with the phpws server. The error 
suggests that the client closed the connection unexpectedly. Does the exception 
occur after a $client->close() ?

The close method currently does not anything more than closing the socket, 
actually it should sent a CLOSE frame to the server and wait for a CLOSE frame 
of the server. I will implement this during the weekend.

Original comment by ch...@devristo.com on 30 Nov 2011 at 5:48

GoogleCodeExporter commented 8 years ago
Thanks for your reply. We have tried with different send methods (you can see 
in the sample code). But the server doesn't get any messages. The exception in 
glassfish we were getting because $client->readMessage() was returning null and 
$msg->getData() was causing unexcepted exit from the code and didn't reach the 
$client->close();

<?php

require_once("websocket.client.php");

        $input = "Hello World!";
        $msg = WebSocketMessage::create($input);
//        $msg = WebSocketMessage76::create($input);

        $client = new WebSocket("ws://localhost:8080/my/websocket");
        $client->open();
        $client->sendMessage($msg);
//        $client->send($input);

        // Wait for an incoming message

        $error_counter = 5;
        while ($error_counter) {
            try {
                $msg = $client->readMessage();
                echo "response: ...";
                if ( $msg != NULL) {
                    echo $msg->getData(); // Prints "Hello World!" when using the demo.php server
                    $error_counter --;
                }
            } catch (Exception $exc) {
                echo $exc->getTraceAsString();
            }
        }

        $client->close();

?>
With best regards

Original comment by mamta.hi...@googlemail.com on 1 Dec 2011 at 12:39

GoogleCodeExporter commented 8 years ago
It seems like a protocol issue, does your websocket server support the 
Websocket Hybi protocol version/draft ?

The phpws client only supports the Hybi version.

Original comment by ch...@devristo.com on 1 Dec 2011 at 4:49

GoogleCodeExporter commented 8 years ago
We modified your code so that it can also support the hixie protocol. You can 
find the changes in the attached files. The connection is perfect and the send 
method functions too.  
Hello,
Our websocket server on glassfish 3.1.1 supports also Hybi protocol, but for 
that something is still missing and we cannot able to build the connection. The 
php client caused the server to call onClose event for unknown reason. We'd 
prefer to use Hybi due to binary data transfer functionality.
The change you made regarding building a socket using stream_socket_client() 
instead of socket_create() is very wellcome because now the php_socket module 
is not needed and it makes able to use this client on more platforms where 
there is no such available module.
Regards

Original comment by mamta.hi...@googlemail.com on 15 Dec 2011 at 11:18

Attachments:

GoogleCodeExporter commented 8 years ago
Weird stuff, so HIXIE works but HYBI does not?

Is glassfish easy to setup? If it is I might have a look this weekend and see 
what causes the issues.

About the stream_ functions, they are indeed better. As a bonus SSL support 
seems relatively easy to implement now.

Thanks a lot for adding HIXIE support to the client. Will integrate your 
changes this weekend. I will also implement HIXIE in the send() / sendFrame() 
methods. 

Original comment by ch...@devristo.com on 15 Dec 2011 at 7:51

GoogleCodeExporter commented 8 years ago
Pushed your changes to git :)

Original comment by ch...@devristo.com on 15 Dec 2011 at 8:51

GoogleCodeExporter commented 8 years ago
Hello,

we are working together with Mamta on this project.

It is relative easy to setup a glassfish 3.1.1, here is the link: 
http://glassfish.java.net/downloads/3.1.1-final.html. Please download and copy 
the attached patches(Kernel.jar & soap-tcp.jar) to GF3.1.1/glassfish/modules 
folder (see 
http://java.net/jira/browse/GRIZZLY-1136?page=com.atlassian.jira.plugin.system.i
ssuetabpanels:comment-tabpanel&focusedCommentId=325521#action_325521).

You can find the chat example which we are using here: 
(http://grizzly.java.net/ sub-project 
grizzly-project/grizzly-samples/grizzly-websockets-chat and sources from here 
http://grizzly.java.net/nonav/docs/docbkx1.9/html/ch01s02.html ). Add the 
attached libraries (glassfish_modules_grizzly_1.9.42) for grizzly in the 
GF3.1.1/glassfish/modules folder.

After you install the glassfish and a domain you can deploy demo Web App 
(*.war/ear) over the admin web console normally located here: localhost:4848 
(if not changed during the instalation).

Greetings,
Todor

Original comment by t.gitc...@gmail.com on 16 Dec 2011 at 1:53

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the pointers, hope I find some time soon to get it all up and 
running :)

Original comment by ch...@devristo.com on 16 Dec 2011 at 4:41

GoogleCodeExporter commented 8 years ago
Installing GF now :)

Original comment by ch...@devristo.com on 22 Dec 2011 at 6:30

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Glassfish install fails with 'The system cannot find the path specified'. 
Running Windows 8 DP. But every Java app up till now worked without any issues.

Any ideas?

Original comment by ch...@devristo.com on 22 Dec 2011 at 6:50

GoogleCodeExporter commented 8 years ago
Anyway, lots of code in the client changed today. Maybe you are lucky and it 
works now.

Original comment by ch...@devristo.com on 24 Dec 2011 at 11:40

GoogleCodeExporter commented 8 years ago
The php client still cause the server to call onClose event, after debugging we 
found out that Draft07Handler.java line number 100 gives the protocol error

   throw new ProtocolError("RSV bit(s) incorrectly set.");

Could you suggest something?

Original comment by mamta.hi...@googlemail.com on 4 Jan 2012 at 12:52

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The RSV bits are reserved, PHPWS doesnt do anything with those (they are set to 
0).

The java file attached suggest that during decoding, that one or more of them 
are 1. The whole decoding part in the java is a bit strange to me. The RSV bits 
are not part of the 'opcode', however their approach *should* work as well. 
Looks like the opcode returned by *checkForLastFrame()* is incorrect.

Original comment by ch...@devristo.com on 5 Jan 2012 at 9:48

GoogleCodeExporter commented 8 years ago
Hmmm seems I mixed up a bit, its not checkForLastFrame() but the following line 
that could be wrong:

byte opcode = handler.get();

I am not sure what handler.get() does, so it might go wrong earlier in the 
chain.

Original comment by ch...@devristo.com on 5 Jan 2012 at 9:50

GoogleCodeExporter commented 8 years ago
Will close this one since no activity since January. Let me know if there is 
something I can do.

Original comment by ch...@devristo.com on 23 Mar 2012 at 7:03