Comments (14)
- Issue Imported From: javaee/grizzly#21
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @glassfishrobot
- Original Issue Closed By:@glassfishrobot
from grizzly.
@glassfishrobot Commented
Reported by [email protected]
from grizzly.
@glassfishrobot Commented
[email protected] said:
Added Fey Zheng to cc list.
from grizzly.
@glassfishrobot Commented
[email protected] said:
I think not have the timeout value is also bad, as it's potential DOS hole.
But it's possible to make timeout value pretty big.
For this reason we can reset Controller's SelectionKeyHandler.
Before starting controller we can do following:
DefaultSelectionKeyHandler handler = new DefaultSelectionKeyHandler();
handler.setTimeout(BIG_VALUE);
controller.setSelectionKeyHandler(handler);
.............continue with controller initialization & start ..............
Does it work for possible usecase?
from grizzly.
@glassfishrobot Commented
[email protected] said:
Actually, there's a little more going on here than I had first noticed.
The DefaultSelectionKeyHandler, Controller (default Controller) and
TCPSelectorHandler (the default SelectorHandler) all make the assumption that
the connections will need to use "keep alive" or some kind of timeout.
For the application Fey is working with, and GlassFish CORBA, the "keep alive"
is not needed nor desired. For this set of applications we do not need to
attach the current time to a SelectionKey when a new connection is established.
We do not need to iterate of the set of SelectionKey doing keep-alive work as
part of a Controller.doSelect(). And, the SelectionKeyHandler does not need to
know anything about an idle timeout or "keep alive".
I think what we need to do is some refactoring so that the
DefaultSelectionKeyHandler, the Controller and TCPSelectorHandler (along the
SSLSelectorHandler and UDPSelectorHandler) continue to work as they do today,
(i.e. we don't break existing applications already written that are using them).
Then, add a new SelectionKeyHandler and SelectorHandler(s) that do not use nor
need the "keep alive" functionality. This will also mean the Controller will
need to be updated since it also has the functionality built into its doSelect()
method.
However we get, I do not care. But, it is something we need to fix and we
should fix it pretty soon.
If we do it properly, we won't need a timeout for the set of applications that
do not need keep-alive. For those applications that do need a keep-alive, I
think we could keep the existing implementation as is.
from grizzly.
@glassfishrobot Commented
[email protected] said:
SelectionKey expiration code is moved from Controller to SelectionKeyHandler.
If this change solves the issue - SelectionKeyHandler.expire(SelectionKey, long)
should be removed from the SelectionKeyHandler interface.
from grizzly.
@glassfishrobot Commented
[email protected] said:
The potential problem with modifying or removing an existing interface is that
we may break existing applications that may be using it. Hence, I do not think
we can remove SelectionKeyHandler.expire(SelectionKey, long) from the
SelectionKeyHandler interface.
The fundamental issue here is that we do not have the flexibility to configure a
Grizzly transport in a manner that does not do "expiring of keys". This
includes (and not necessarily an exhaustive list):
1.) Controller.doSelect() should only do "expiring of keys" for those
applications that need it, (which should be the default). Applications that do
not need "expiring of keys" should be able to disable this functionality.
2.) The attaching of a Long (System.currentTimeMillis()) to a SelectionKey's
attachment should not be mandatory. Again, this should be the default since
"expiring keys" is the default configuration. But, when it is not desired, then
any attaching of a Long (System.currentTimeMillis()) should not be done at
"accept time", or in any other location.
In other words, we need to be able to have the default configuration for a
Grizzly transport that enables "expiring keys" and we need to be able to
configure a Grizzly transport that disables the "expiring keys" features and any
of its artifacts.
Perhaps this is justification for integrating a TransportConfiguration interface
/ object that allows one to configure a Grizzly transport more easily.
from grizzly.
@glassfishrobot Commented
[email protected] said:
I agree with both of you The goal of the SelectionKeyHandler is to give
control, for an application, of the SelectionKey life cycle (and a plus when you
compare to other framework). Looking at Alexey's changes, I would think we
should deprecate the expire(SelectionKey), and leave the new interface there.
That way the initial contract for the interface still meet the goal I was having
when designing it.
We should send a warning on the dev/user list to describe the interface changes.
from grizzly.
@glassfishrobot Commented
[email protected] said:
I will soon commit a tentative fix that remove all problems/dependencies Charlie
has found.
from grizzly.
@glassfishrobot Commented
[email protected] said:
Tentative fix:
Sending trunk/modules/grizzly/src/main/java/com/sun/grizzly/Controller.java
Sending
trunk/modules/grizzly/src/main/java/com/sun/grizzly/DefaultSelectionKeyHandler.java
Sending
trunk/modules/grizzly/src/main/java/com/sun/grizzly/SelectionKeyHandler.java
Sending
trunk/modules/grizzly/src/main/java/com/sun/grizzly/TCPSelectorHandler.java
Sending
trunk/modules/http/src/main/java/com/sun/grizzly/http/SelectorThread.java
Transmitting file data .....
Committed revision 425.
from grizzly.
@glassfishrobot Commented
[email protected] said:
Fix target
from grizzly.
@glassfishrobot Commented
Was assigned to [email protected]
from grizzly.
@glassfishrobot Commented
This issue was imported from java.net JIRA GRIZZLY-21
from grizzly.
@glassfishrobot Commented
Marked as fixed on Wednesday, December 16th 2009, 6:14:11 pm
from grizzly.
Related Issues (20)
- Grizzly is not compatible with Servlet 6 HOT 10
- jakarta.servlet:jakarta.servlet-api:6.0.0 is not available in maven central HOT 6
- Threads are not closed once Grizzly's HttpServer shuts down HOT 3
- SingleEndpointPool.cleanupIdleConnections() infinity loop HOT 4
- Release Grizzly to Maven central HOT 10
- No HTTP 100 intermediate response for POST with chunked transfer encoding
- Session timeout does not tolerate system time changes HOT 1
- Out of memory caused by TrimmableHeapBuffer HOT 1
- DefaultSessionManager uses predictable java.util.Random instead of java.security.SecureRandom HOT 1
- SpotBugs analysis: Questionable use of non-short-circuit logic HOT 1
- SpotBugs analysis: Holder.toString() may return null HOT 3
- Grizzly 2.4.4/4.0.0 missing Content-Type in response HOT 7
- 4.0.1 Deprecated `AttributeBuilder.createAttribute` with no replacement
- Adjust module-info
- Release Grizzly with fixed module.info HOT 1
- (Possibly) Incorrect initial max memory size when building a direct memory buffer pool
- Grizzly does not build against Servlet 6.1.0-M1 HOT 8
- Avoid using ThreadLocals for caching expensive resources HOT 1
- Warnings printed out for HTTP/2 Settings HOT 1
- Move Grizzly to the GlassFish project? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grizzly.