|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
UDP problem after restartarting ControllerHi,
I am implementing an UDP server (listening on a fixed port) with Grizzly. One of use cases is to start and stop the UDP server without restarting the JVM. So I implemented the start() and stop() methods: public void start() { controller = new Controller(); udpSelector = new UDPSelectorHandler(); udpSelector.setPort(5555); controller.addSelectorHandler(udpSelector); mySharedPipeline = new DefaultPipeline(); controller.setPipeline(mySharedPipeline); pciHandler = new StackInstanceHandler(); controller.setProtocolChainInstanceHandler(pciHandler); th = new Thread(controller); th.start(); } public void stop() { controller.stop(); } The server works fine until I restart it (call stop() then start()). Then I get a strange behaviour in the Filter that parses the messages... The full scenario is: 1. start the server 2. send some (e.g. 5 different) messages from the client, they get parsed, answers are sent, all is Ok 3. restart the server 4. send a new message from the client 5. my Filter.execute() is called, but the buffer is not as expected. It contains bytes from the last message sent in step 2. I get the buffer this way: WorkerThread workerThread = ((WorkerThread) Thread.currentThread()); ByteBuffer buffer = workerThread.getByteBuffer(); It looks like the bytes from the last message in step 2 remain somewhere in the buffer/socket/controller and are sent to my Filter when a totally new message is received on the socket. I tried also: mySharedPipeline.stopPipeline(); udpSelector.shutdown(); in the stop() method, but the results were the same. Any idea what could be wrong? |
|
|
Re: UDP problem after restartarting ControllerHi,
looks like bug, I'll appreciate if you can fill the issue on the issuetracker - I'll take a look and fix ASAP. Thanks. WBR, Alexey. On Jul 21, 2008, at 15:28 , LittleBear wrote: > > Hi, > > I am implementing an UDP server (listening on a fixed port) with > Grizzly. > One of use cases is to start and stop the UDP server without > restarting the > JVM. So I implemented the start() and stop() methods: > > public void start() { > controller = new Controller(); > > udpSelector = new UDPSelectorHandler(); > udpSelector.setPort(5555); > controller.addSelectorHandler(udpSelector); > > mySharedPipeline = new DefaultPipeline(); > controller.setPipeline(mySharedPipeline); > > pciHandler = new StackInstanceHandler(); > controller.setProtocolChainInstanceHandler(pciHandler); > > th = new Thread(controller); > th.start(); > } > > public void stop() { > controller.stop(); > } > > > The server works fine until I restart it (call stop() then start()). > Then I > get a strange behaviour in the Filter that parses the messages... > The full scenario is: > > 1. start the server > 2. send some (e.g. 5 different) messages from the client, they get > parsed, > answers are sent, all is Ok > 3. restart the server > 4. send a new message from the client > 5. my Filter.execute() is called, but the buffer is not as expected. > It > contains bytes from the last message sent in step 2. I get the > buffer this > way: > > WorkerThread workerThread = ((WorkerThread) Thread.currentThread()); > ByteBuffer buffer = workerThread.getByteBuffer(); > > > It looks like the bytes from the last message in step 2 remain > somewhere in > the buffer/socket/controller and are sent to my Filter when a > totally new > message is received on the socket. > > I tried also: > mySharedPipeline.stopPipeline(); > udpSelector.shutdown(); > in the stop() method, but the results were the same. > > > Any idea what could be wrong? > > -- > View this message in context: http://www.nabble.com/UDP-problem-after-restartarting-Controller-tp18568653p18568653.html > Sent from the Grizzly - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: UDP problem after restartarting ControllerSalut,
issue tracker is here just in case :-) https://grizzly.dev.java.net/issues/ A+ -- Jeanfrancois Oleksiy Stashok wrote: > Hi, > > looks like bug, > I'll appreciate if you can fill the issue on the issuetracker - I'll > take a look and fix ASAP. > > Thanks. > > WBR, > Alexey. > > On Jul 21, 2008, at 15:28 , LittleBear wrote: > >> >> Hi, >> >> I am implementing an UDP server (listening on a fixed port) with Grizzly. >> One of use cases is to start and stop the UDP server without >> restarting the >> JVM. So I implemented the start() and stop() methods: >> >> public void start() { >> controller = new Controller(); >> >> udpSelector = new UDPSelectorHandler(); >> udpSelector.setPort(5555); >> controller.addSelectorHandler(udpSelector); >> >> mySharedPipeline = new DefaultPipeline(); >> controller.setPipeline(mySharedPipeline); >> >> pciHandler = new StackInstanceHandler(); >> controller.setProtocolChainInstanceHandler(pciHandler); >> >> th = new Thread(controller); >> th.start(); >> } >> >> public void stop() { >> controller.stop(); >> } >> >> >> The server works fine until I restart it (call stop() then start()). >> Then I >> get a strange behaviour in the Filter that parses the messages... >> The full scenario is: >> >> 1. start the server >> 2. send some (e.g. 5 different) messages from the client, they get >> parsed, >> answers are sent, all is Ok >> 3. restart the server >> 4. send a new message from the client >> 5. my Filter.execute() is called, but the buffer is not as expected. It >> contains bytes from the last message sent in step 2. I get the buffer >> this >> way: >> >> WorkerThread workerThread = ((WorkerThread) Thread.currentThread()); >> ByteBuffer buffer = workerThread.getByteBuffer(); >> >> >> It looks like the bytes from the last message in step 2 remain >> somewhere in >> the buffer/socket/controller and are sent to my Filter when a totally new >> message is received on the socket. >> >> I tried also: >> mySharedPipeline.stopPipeline(); >> udpSelector.shutdown(); >> in the stop() method, but the results were the same. >> >> >> Any idea what could be wrong? >> >> -- >> View this message in context: >> http://www.nabble.com/UDP-problem-after-restartarting-Controller-tp18568653p18568653.html >> >> Sent from the Grizzly - Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@... >> For additional commands, e-mail: users-help@... >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: UDP problem after restartarting ControllerHi,
can you pls. attach the sources to reproduce the issue, or at least Filters :) Thanks. WBR, Alexey. On Jul 21, 2008, at 15:28 , LittleBear wrote: > > Hi, > > I am implementing an UDP server (listening on a fixed port) with > Grizzly. > One of use cases is to start and stop the UDP server without > restarting the > JVM. So I implemented the start() and stop() methods: > > public void start() { > controller = new Controller(); > > udpSelector = new UDPSelectorHandler(); > udpSelector.setPort(5555); > controller.addSelectorHandler(udpSelector); > > mySharedPipeline = new DefaultPipeline(); > controller.setPipeline(mySharedPipeline); > > pciHandler = new StackInstanceHandler(); > controller.setProtocolChainInstanceHandler(pciHandler); > > th = new Thread(controller); > th.start(); > } > > public void stop() { > controller.stop(); > } > > > The server works fine until I restart it (call stop() then start()). > Then I > get a strange behaviour in the Filter that parses the messages... > The full scenario is: > > 1. start the server > 2. send some (e.g. 5 different) messages from the client, they get > parsed, > answers are sent, all is Ok > 3. restart the server > 4. send a new message from the client > 5. my Filter.execute() is called, but the buffer is not as expected. > It > contains bytes from the last message sent in step 2. I get the > buffer this > way: > > WorkerThread workerThread = ((WorkerThread) Thread.currentThread()); > ByteBuffer buffer = workerThread.getByteBuffer(); > > > It looks like the bytes from the last message in step 2 remain > somewhere in > the buffer/socket/controller and are sent to my Filter when a > totally new > message is received on the socket. > > I tried also: > mySharedPipeline.stopPipeline(); > udpSelector.shutdown(); > in the stop() method, but the results were the same. > > > Any idea what could be wrong? > > -- > View this message in context: http://www.nabble.com/UDP-problem-after-restartarting-Controller-tp18568653p18568653.html > Sent from the Grizzly - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: UDP problem after restartarting ControllerI put the filter from which I extracted all the implementation details that have nothing to do with Grizzly... hope this is enough? Otherwise I can try to make a complete test code.
|
|
|
Re: UDP problem after restartarting ControllerCan you try to put
buffer.clear() operation in your Filter to the finally block, so it will be called all the time for filter.execute() method? Thanks. WBR, Alexey. On Jul 22, 2008, at 16:37 , LittleBear wrote: > > I put the filter from which I extracted all the implementation > details that > have nothing to do with Grizzly... hope this is enough? Otherwise I > can try > to make a complete test code. > > > Oleksiy Stashok wrote: >> >> Hi, >> >> can you pls. attach the sources to reproduce the issue, or at least >> Filters :) >> >> Thanks. >> >> WBR, >> Alexey. >> >> > > -- > View this message in context: http://www.nabble.com/UDP-problem-after-restartarting-Controller-tp18568653p18589457.html > Sent from the Grizzly - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: UDP problem after restartarting ControllerIt makes no difference, same problem occurs.
|
|
|
Re: UDP problem after restartarting ControllerHmm... can not reproduce the bug :(
Can you pls. send complete testcase code? Thanks. WBR, Alexey. On Jul 22, 2008, at 17:38 , LittleBear wrote: > > It makes no difference, same problem occurs. > > > Oleksiy Stashok wrote: >> >>> Oleksiy Stashok wrote: >>>> >>>> Hi, >>>> >>>> can you pls. attach the sources to reproduce the issue, or at least >>>> Filters :) >>>> >>>> Thanks. >>>> >>>> WBR, >>>> Alexey. >>>> >> > > -- > View this message in context: http://www.nabble.com/UDP-problem-after-restartarting-Controller-tp18568653p18592235.html > Sent from the Grizzly - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: UDP problem after restartarting ControllerHi,
here is the issue reason. Please check your filter UdpFilter.processPacket() method. There is line: ByteArrayInputStream bais = new ByteArrayInputStream(buffer.array(), 0, buffer.limit()); it should be changed with: ByteArrayInputStream bais = new ByteArrayInputStream(buffer.array(), buffer.arrayOffset(), buffer.limit()); and everything should work :) Thanks. WBR, Alexey. On Jul 22, 2008, at 17:38 , LittleBear wrote: > > It makes no difference, same problem occurs. > > > Oleksiy Stashok wrote: >> >>> Oleksiy Stashok wrote: >>>> >>>> Hi, >>>> >>>> can you pls. attach the sources to reproduce the issue, or at least >>>> Filters :) >>>> >>>> Thanks. >>>> >>>> WBR, >>>> Alexey. >>>> >> > > -- > View this message in context: http://www.nabble.com/UDP-problem-after-restartarting-Controller-tp18568653p18592235.html > Sent from the Grizzly - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free Forum Powered by Nabble | Forum Help |