Re: Connect from C++ SSL Client to Mina SSL server

2012-06-11 Thread Emmanuel Lécharny

Le 6/11/12 10:36 AM, madhurima v a écrit :

Thanks for your quick response.
We are using Mina 2.0-M1 from last 4 years,due to the same reason i was
tried SSL connection also with same version.
as per your suggestion we updated the version to Mina-2.0.0-M5 and tried the
SSL connection
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.mina/mina-example
/2.0.0-M5/org/apache/mina/example/echoserver/ssl/BogusSslContextFactory.java
?av=f.

Following is my issue.
1. generated bogus certificate using keystore commands available in
BogusSslContextFactory.java class.
 // NOTE: The keystore was generated using keytool:
 //   keytool -genkey -alias bogus -keysize 512 -validity 3650
 //   -keyalg RSA -dname "CN=bogus.com, OU=XXX CA,
 //   O=Bogus Inc, L=Stockholm, S=Stockholm, C=SE"
 //   -keypass boguspw -storepass boguspw -keystore bogus.cert
 and we used same certificate in both sides and both ssl client and
server connected successfully.
2. After getting the connection we need to get the message in handler
-messageReceive() method.
 here i am unable to get the original message. and automatically closing
the connection.

 Mina server log :
SSL ON
Listening on port 9123
[12:19:24] NioProcessor-1 INFO  [] []
[org.apache.mina.example.echoserver.EchoProtocolHandler] -  OPENED
[12:19:26] NioProcessor-1 INFO  [] []
[org.apache.mina.example.echoserver.EchoProtocolHandler] - Received :
SESSION_UNSECURED


Here, the handshake has failed. It might be because the client is trying 
to negociate some cyphers that are not supported by MINA server.


The best things would be to use wireshark to analyze what is being 
transmitted during the handshake. You can provide the output.


Also there is a way to set up some debugging for SSL 
(http://docs.oracle.com/javase/1.5.0/docs/guide/security/jsse/ReadDebug.html)



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[REPORT] Apache MINA, take 2

2012-07-09 Thread Emmanuel Lécharny

A new version, with Bernd's suggestions :


MINA board report draft :
--

Apache MINA is a network application framework which helps users
develop high performance and high scalability network applications
easily.

Releases

* Apache MINA SSHd 0.7.0 has been released on june, 19th.

Community
-
* MINA 3 has been improved, but it's still moving slowly. Some bug fixes 
have been provided for Vysper and FtpServer this quarters.

* No new committers or PMC changes

Development
---
* MINA 3 remains in a preliminary state, with a lot to do to get it 
alive and kicking.

* Vysper has seen some important improvements and bugfixes.
* The web sites have to be moved to the new Apache CMS before the end if 
ths year, we need to find some time this sumer to initiate the migraton.


Issues
--
No board level issues at this time.

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[MINA 3] NioTcpServer bind() potential issue

2012-07-22 Thread Emmanuel Lécharny

Hi,

while checking the Mina 3 code, I saw that the NioTcpServer bind() 
method might potentially leads to losing some events, if I'm not wrong.


The bind() method does this :

public synchronized void bind(final SocketAddress localAddress) 
throws IOException {
serverChannel = ServerSocketChannel.open(); <<-- here, 
the channel is not ready to accept incoming requests

...
serverChannel.socket().bind(address); << !!! Now, the 
server can receive incoming connections

serverChannel.configureBlocking(false);

acceptProcessor = this.strategy.getSelectorForBindNewAddress();

acceptProcessor.addServer(this); <<--- We then create the 
selector here


So we can open a serveur socket, but we are not ready yet to process the 
requests...Woudln't it make more sense to let the acceptProcessor do the 
bind ?


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [MINA 3] NioTcpServer bind() potential issue

2012-07-23 Thread Emmanuel Lécharny

Le 7/23/12 9:08 AM, Julien Vermillard a écrit :

On Sun, Jul 22, 2012 at 10:21 PM, Emmanuel Lécharny  wrote:

Hi,

while checking the Mina 3 code, I saw that the NioTcpServer bind() method
might potentially leads to losing some events, if I'm not wrong.

The bind() method does this :

 public synchronized void bind(final SocketAddress localAddress) throws
IOException {
 serverChannel = ServerSocketChannel.open(); <<-- here, the
channel is not ready to accept incoming requests
 ...
 serverChannel.socket().bind(address); << !!! Now, the server can
receive incoming connections
 serverChannel.configureBlocking(false);

 acceptProcessor = this.strategy.getSelectorForBindNewAddress();

 acceptProcessor.addServer(this); <<--- We then create the selector
here

So we can open a serveur socket, but we are not ready yet to process the
requests...Woudln't it make more sense to let the acceptProcessor do the
bind ?


The accept event will be queued at the kernel level, and will be
processed by the first select,


Is this guaranteed ?


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: how to get ServerSessionobject within each session thread

2012-07-23 Thread Emmanuel Lécharny

Le 7/23/12 4:24 PM, Samaira Gupta a écrit :

Hi ,

I want to know how can i get the ioSession or ServerSession object within
each session thread

Do *not* post mails on every mailing list you know. This is a waste of 
our time...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: how to get ServerSessionobject within each session thread

2012-07-23 Thread Emmanuel Lécharny

Le 7/23/12 4:24 PM, Samaira Gupta a écrit :

Hi ,

I want to know how can i get the ioSession or ServerSession object within
each session thread


You obviusly have it. It's part of the parameters you get in the handler.

Did I missed something, or you'd like to be a bit more explicit about 
your need ?


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: FtpServer trunk/r1369117 unit tests failing ?

2012-08-06 Thread Emmanuel Lécharny

Le 8/6/12 6:16 PM, Darryl L. Miles a écrit :


Hello (my first post to the list),


Hi,
can you provide the JVM version you are using ? Same for maven ?



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[VOTE] MINA 2.0.5 Release

2012-08-21 Thread Emmanuel Lécharny
/browse/DIRMINA-867>] - Needs 
meaningful error message when AbstractIoSession.write called with null

 *

   [DIRMINA-888  <https://issues.apache.org/jira/browse/DIRMINA-888>] - Add the 
ability to get the write queue size like: session.getWriterRequestQueue().size();

New Feature

 *

   [DIRMINA-816  <https://issues.apache.org/jira/browse/DIRMINA-816>] - 
NioSocketConnector missing defaultLocalAddress

Task

 *

   [DIRMINA-477  <https://issues.apache.org/jira/browse/DIRMINA-477>] - Update 
page about differences between 1.x and 2.x

 *

   [DIRMINA-681  <https://issues.apache.org/jira/browse/DIRMINA-681>] - Strange 
CPU peak occuring at fixed interval when several thousand connections active

A temporary tag has been created (it can be removed if the vote is not
approved):http://svn.apache.org/viewvc/mina/tags/2.0.5/

The newly approved Nexus has been used for the preparation of this release and
all final artifacts are stored in a staging repository:
https://repository.apache.org/content/repositories/orgapachemina-023/

The subversion revision for the tag is : 1375426
http://svn.apache.org/viewvc?rev=1375426&view=rev

The sources distributions are available for download on :
https://repository.apache.org/content/repositories/orgapachemina-023/org/apache/mina/mina-parent/2.0.5/

Let's vote :
[ ] +1 | Release MINA 2.0.5
[ ] ±0 | Abstain
[ ] -1  | Do*NOT* release MINA 2.0.5

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com  



[Cancel] [VOTE] MINA 2.0.5 Release

2012-08-21 Thread Emmanuel Lécharny

There are some missing AL headers, plus a few things to fix.

I cancel the vote atm. Will be back later !



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] MINA 2.0.5 Release

2012-08-21 Thread Emmanuel Lécharny

Le 8/21/12 12:23 PM, sebb a écrit :

On 21 August 2012 10:12, Emmanuel Lécharny  wrote:


A temporary tag has been created (it can be removed if the vote is not
approved):http://svn.apache.org/viewvc/mina/tags/2.0.5/

It would be better to use an immutable tag with an RCn suffix which is
renamed/copied when the vote succeeeds.
Yes, but this is not the way we chose to proceed at MINA... Maybe for 
MINA 3 ?


Some issues with SVN props (non-blocking):

svn ps svn:eol-style native
mina-statemachine/src/main/java/org/apache/mina/statemachine/annotation/OnEntry.java
svn ps svn:eol-style native
mina-statemachine/src/main/java/org/apache/mina/statemachine/annotation/OnExit.java
svn ps svn:eol-style native
mina-statemachine/src/main/java/org/apache/mina/statemachine/transition/AbstractSelfTransition.java
svn ps svn:eol-style native
mina-statemachine/src/main/java/org/apache/mina/statemachine/transition/SelfTransition.java
svn ps svn:eol-style native
mina-statemachine/src/main/java/org/apache/mina/statemachine/transition/MethodSelfTransition.java


Fixed with http://svn.apache.org/viewvc?rev=1375490&view=rev


-1: Missing AL header:

  ===
  ==D:/RC/2.0.5/ImprovedJavaConventions.xml
  ===
  




Seems wrong for this file to be at top-level; also it ought to be
identified as being for Eclipse only.
I recommmend using an approach like the one Tomcat use:

http://svn.apache.org/repos/asf/tomcat/trunk/res/ide-support/eclipse/

Note that they include AL headers.


I have created a sub-directory "resources" and moved this file there. We 
can't inject the ASF header in it, as it's a generated file (so per se, 
it's an eclipse file).





The newly approved Nexus has been used for the preparation of this release
and
all final artifacts are stored in a staging repository:
https://repository.apache.org/content/repositories/orgapachemina-023/

The subversion revision for the tag is : 1375426
http://svn.apache.org/viewvc?rev=1375426&view=rev

The sources distributions are available for download on :
https://repository.apache.org/content/repositories/orgapachemina-023/org/apache/mina/mina-parent/2.0.5/

-1: There does not seem to be a binary distribution package anywhere.


I forgot to pushed the binary on my people.apache.org account. Will do...


-1: The top-level NOTICE.txt file has:
Apache MINA
Copyright 2007 The Apache Software Foundation.

That should probably be:

Apache MINA
Copyright 2007-2012 The Apache Software Foundation.

Also are you sure that all the content is *required* ?

The ASF releases source (and SVN is source) so the NOTICE file should
relate to what is actually included.


Right. We just depend on this libs, we don't include any part of the 
sources from those projects. No need to have them listed in the 
NOTICES.txt file then.


Fixed with http://svn.apache.org/viewvc?rev=1375521&view=rev


If MINA releases a binary bundle which includes 3rd party items, the
N&L files it contains should be updated accordingly.


Working on it.

Thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[VOTE] MINA 2.0.5, take 2

2012-08-21 Thread Emmanuel Lécharny
88 <https://issues.apache.org/jira/browse/DIRMINA-888>] - 
Add the ability to get the write queue size like: 
session.getWriterRequestQueue().size();


New Feature

 * [DIRMINA-816 <https://issues.apache.org/jira/browse/DIRMINA-816>] - 
NioSocketConnector missing defaultLocalAddress


Task

 * [DIRMINA-477 <https://issues.apache.org/jira/browse/DIRMINA-477>] - 
Update page about differences between 1.x and 2.x


 * [DIRMINA-681 <https://issues.apache.org/jira/browse/DIRMINA-681>] - 
Strange CPU peak occuring at fixed interval when several thousand 
connections active


A temporary tag has been created (it can be removed if the vote is not 
approved):

http://svn.apache.org/viewvc/mina/tags/2.0.5/

The newly approved Nexus has been used for the preparation of this 
release and

all final artifacts are stored in a staging repository:
https://repository.apache.org/content/repositories/orgapachemina-025/

The subversion revision for the tag is : 1375587
http://svn.apache.org/viewvc?rev=1375587&view=rev

The sources distributions are available for download on :
https://repository.apache.org/content/repositories/orgapachemina-025/org/apache/mina/mina-parent/2.0.5/

The binary distributions are avainlable for download on :
http://people.apache.org/~elecharny/

Let's vote :
[ ] +1 | Release MINA 2.0.5
[ ] ±0 | Abstain
[ ] -1  | Do*NOT* release MINA 2.0.5

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] MINA 2.0.5, take 2

2012-08-21 Thread Emmanuel Lécharny

Le 8/22/12 6:17 AM, Alan D. Cabrera a écrit :

I can't get

mvn rat:check

mvn apache-rat:chack


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] MINA 2.0.5, take 2

2012-08-22 Thread Emmanuel Lécharny

Le 8/22/12 7:53 AM, Alan D. Cabrera a écrit :

On Aug 21, 2012, at 10:50 PM, Emmanuel Lécharny wrote:


Le 8/22/12 6:17 AM, Alan D. Cabrera a écrit :

I can't get

mvn rat:check

mvn apache-rat:chack


[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.8:check 
(default-cli) on project mina-parent: Too many unapproved licenses: 1 -> [Help 
1]

Can you provide the target/rat.txt file ?

Also on which package are your running the check ? Is t o the source 
tarball, or on the  checked out sources ?



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] MINA 2.0.5, take 2

2012-08-22 Thread Emmanuel Lécharny

Le 8/22/12 7:53 AM, Alan D. Cabrera a écrit :

On Aug 21, 2012, at 10:50 PM, Emmanuel Lécharny wrote:


Le 8/22/12 6:17 AM, Alan D. Cabrera a écrit :

I can't get

mvn rat:check

mvn apache-rat:chack


[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.8:check 
(default-cli) on project mina-parent: Too many unapproved licenses: 1 -> [Help 
1]


Ah, shit, my bad...

The NOTICE-bin.txt has not been excluded from the check... (it does not 
have a ASL header)


Certainly not a blocking error, but something to fix in order not to be 
a problem in the next release...



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Next planned release for apache-ftpserver?

2012-08-22 Thread Emmanuel Lécharny

Le 8/22/12 2:59 PM, Niklas Gustavsson a écrit :

On Wed, Aug 22, 2012 at 1:10 PM, Sascha Vogt  wrote:

Maybe this is better asked on the developers mailinglist. Is there a
plan when the next version of ftpserver is released? Maybe we can also
lend a hand in fixing a few outstanding issues, which prevent a new release.

There shouldn't be anything stopping us from releasing 1.0.7. I'll
prepare a release and start a vote for it in the next few days.


Will you try to upgrade to MINA 2.0.5 ?


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: How to SFTP Server Implemetation

2012-08-28 Thread Emmanuel Lécharny

Le 8/28/12 7:45 AM, 정명구 a écrit :

Hi. I am Mark Jeong.

i want to make SFTP Server using Mina SSHD.

but, i not found SFTP Implementatio in SshSever Code

How to sftp implementaion in SshSever source ?

thank you !!!

Please, do *not* cross-post. This is the development mailing list, where 
we discuss about how MINA is built, not the users maliling list, for 
people *using* MINA.



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[ANNOUNCE] Apache MINA 2.0.5 released

2012-08-29 Thread Emmanuel Lécharny


The Apache MINA project is pleased to announce MINA 2.0.5 ! This
version is a bug fix release.

Apache MINA is a network application framework which helps users
develop high performance and high scalability network applications
easily by providing an abstract, event-driven, asynchronous API over
various transports such as TCP/IP and UDP/IP vis Java NIO.

The Apache MINA project website includes resources such as
introductory presentation slides, tutorials, and examples to help you
learn MINA as soon as possible.

This version fixes a few errors found since we released 2.0.4

Download :
=
 *http://mina.apache.org/downloads.html

Quick links :
==
* Homepage -http://mina.apache.org/
* FAQ -http://mina.apache.org/faq.html
* Testimonials -http://mina.apache.org/testimonials.html
* Documentation -http://mina.apache.org/documentation.html
* Performance -http://mina.apache.org/performance-test-reports.html

We recommend all users to upgrade to this release. We consider this a
stable and production ready release.

Release notes :
=


Bug

  * DIRMINA-772 - First sent message is not garbage collected per session
  * DIRMINA-817 - Packaging is buggy
  * DIRMINA-829 - AbstractIoBuffer.getSlice(int index, int length) has
incorrect behavior
  * DIRMINA-835 - IoHandler's sessionCreated and sessionOpened method
can receive notifications when MINA's internal socket connection built
  * DIRMINA-840 - Logic Error in ByteArrayPool implementation
  * DIRMINA-842 - Crash on Android
  * DIRMINA-846 - AprSocketAcceptor doesn't work and throws
IOExceptions many times.
  * DIRMINA-871 - DefaultIoSessionAttributeMap returns the defaultValue
parameter if no entry is found for the specified key, but does not add
that new key/value pair to the map as specified in the javadocs.
  * DIRMINA-880 - Implementation of SslFilter#isCloseNotify() is incorrect
  * DIRMINA-886 - isBrokenConnection
  * DIRMINA-887 - mutil bind localAddress
  * DIRMINA-894 - java.io.IOException: Broken Pipe infinite loop
  * DIRMINA-897 - atomicity violation bugs because of misusing
concurrent collections
  * DIRMINA-898 - A wakeup() is issued in a thread before the target
select() is executed.
  * DIRMINA-900 - One MINA 2.0.4 test is failing when run with a 1.7 jdk


Improvement

  * DIRMINA-645 - SslFilter should start initiating handshake from
sesionCreated() rather than from onPostAdd()
  * DIRMINA-847 - Entry and Exit action support for Mina state machine
  * DIRMINA-867 - Needs meaningful error message when
AbstractIoSession.write called with null
  * DIRMINA-888 - Add the ability to get the write queue size like:
session.getWriterRequestQueue().size();


Task

  * DIRMINA-681 - Strange CPU peak occuring at fixed interval when
several thousand connections active



The Apache MINA PMC

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com






Re: multiple delimiters support with apache mina

2012-09-03 Thread Emmanuel Lécharny

Le 9/3/12 3:36 PM, daniel vettori a écrit :

Hi,

I m using Apache mina in my socket component. I used TextLineDecoder as my
sample for my Socket component. In my component i m using single delimiter
as end of message to/from socket. Now, i want to implement same thing with
multiple delimiters support.
Supposee i have message as (with delimiters ; :  ,)
this;is:sample,

and output as
this
is
sample

So,how should i approach for this problem...


The best solution would be to write your own version of the 
TextLinedecoer, a version accepting more than one delimiter.


Just have a look at the TexlineDecoder code, you should be able to 
extend it to get what you need.

http://mina.apache.org/report/trunk/xref/org/apache/mina/filter/codec/textline/TextLineDecoder.html

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Migration from Confluence to CMS

2012-09-10 Thread Emmanuel Lécharny

Hi guys,

all the Apache projects must migrate from Confluence to use the Apache 
CMS by the end of this year. We have been warned that doing it at the 
last minute will most certainly be bound to failure, due to the lack of 
support we may have by then.


I think it's time for us to start the migration of the sites (MINA, 
FtpServer, SSHd, Vysper and Asyncweb).


I have done some preliminary experiments on Directory project, and I 
think the best would be to use Asyncweb as a playground - unless any of 
you wants to start on another project.


I'll come back later this month with more feedback.

Btw, it would be a good timing to review the MINA doco, and probably to 
deprecate MINA 1.0 and 1.1, which are not any more used (AFAICT).


Thoughts ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: websocket codec in Apache Mina

2012-09-13 Thread Emmanuel Lécharny

Le 9/12/12 7:25 PM, Dhruv Chopra a écrit :

Hi,

We are using Apache Mina for NIO in our gaming server. In our
scenario, the same server must handle data transfer across native
clients (iOS, Android) and web browsers (which are communicating
through websockets).
To do this, we have prototyped an encoder and decoder in the MINA
chain which will do the websocket handshake and manage communication
over WebSocket dataframes (as in RFC 6455).
My question is that is there already a filter for doing this (or one
under development)? If not, we would like to contribute what we have
done to the Apache Mina project and would like to know the process.

Thanks,
Dhruv

Product Site : http://appwarp.shephertz.com/
Company Site : http://shephertz.com/

Hi !

First, thanks a lot for you interest in MINA. We would be pleased to 
receive such a contribution, of course. Ashish and Bernd described the 
process to follow (JIRA, etc), and I'll just add a few comments :
- technically, you will give the ASF those files. Be sure that all the 
developprs who contributed to your work agree to give their work (if you 
derived some external code to create your codec).


Otherwise, as said, just push the files, and we will include them to MINA.

I have another question : as I'm pretty sure this code is going to be 
used by many people, so will you have time to provide some support ?  
Note that we don't mandate you to do so, but that's probably the best 
way to benefit from the community, and to be part of it.


Many thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: MINA 2.0.5 backwards compatibility issue

2012-09-17 Thread Emmanuel Lécharny

Le 9/17/12 2:21 PM, Niklas Gustavsson a écrit :

Hey

yo,


When upgrading to MINA 2.0.5 in FtpServer, I noticed one of the
FtpServer unit tests breaking. Turns out it's due to a change
(r1374997) in MINA 2.0.5 TextLineDecoder which no longer will throw an
exception on some input which is not valid for the charset. For
example, this test will throw an exception on MINA 2.0.4, but will
pass and output a broken String on 2.0.5.


Seems like a regression.

The modification in MINA 2.0.5 was wuite minor, and was expecting to fix 
a problme with lines containing a 0x00 char (which is valid in Strings) 
which was considered -wrongly - as a line terminator.


I' investigating the impact on FtpServer test atm.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: MINA 2.0.5 backwards compatibility issue

2012-09-17 Thread Emmanuel Lécharny

Le 9/17/12 2:50 PM, Emmanuel Lécharny a écrit :

Le 9/17/12 2:21 PM, Niklas Gustavsson a écrit :

Hey

yo,


When upgrading to MINA 2.0.5 in FtpServer, I noticed one of the
FtpServer unit tests breaking. Turns out it's due to a change
(r1374997) in MINA 2.0.5 TextLineDecoder which no longer will throw an
exception on some input which is not valid for the charset. For
example, this test will throw an exception on MINA 2.0.4, but will
pass and output a broken String on 2.0.5.


Seems like a regression.

The modification in MINA 2.0.5 was wuite minor, and was expecting to 
fix a problme with lines containing a 0x00 char (which is valid in 
Strings) which was considered -wrongly - as a line terminator.


I' investigating the impact on FtpServer test atm.




I have a fix for the issue, but it will take a bit of time to get a new 
MINA release cut.


Basically, I don't use anymore 'new String()' directly, as it swallows 
bad chars and ignore them (they will be replaced by ? in the resulting 
String).


The patch is :

Index: 
mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java

===
--- 
mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java 
(revision 1375418)
+++ 
mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java 
(working copy)

@@ -19,6 +19,8 @@
  */
 package org.apache.mina.filter.codec.textline;

+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
@@ -269,7 +271,11 @@
 try {
 byte[] data = new byte[buf.limit()];
 buf.get(data);
-writeText(session, new String(data, 
ctx.getDecoder().charset()), out);

+CharsetDecoder decoder = ctx.getDecoder();
+
+CharBuffer buffer = 
decoder.decode(ByteBuffer.wrap(data));

+String str = new String(buffer.array());
+writeText(session, str, out);
 } finally {
 buf.clear();
 }


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: MINA 2.0.5 backwards compatibility issue

2012-09-17 Thread Emmanuel Lécharny

Le 9/17/12 4:01 PM, Niklas Gustavsson a écrit :

On Mon, Sep 17, 2012 at 3:33 PM, Emmanuel Lécharny  wrote:

I have a fix for the issue, but it will take a bit of time to get a new MINA
release cut.

No worries, I'd rather have this working properly than rush something out.


Thinking about it more, I wonder if the fact that we receive bad chars, 
but still produce a String, is not a better solution ?


All in all, you'll be able to see that the file does not exist and 
return a correct error, instead of handling an exception.


wdyt ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: MINA 2.0.5 backwards compatibility issue

2012-09-17 Thread Emmanuel Lécharny

Le 9/17/12 8:47 PM, Niklas Gustavsson a écrit :

On Mon, Sep 17, 2012 at 4:03 PM, Emmanuel Lécharny  wrote:

Thinking about it more, I wonder if the fact that we receive bad chars, but
still produce a String, is not a better solution ?

All in all, you'll be able to see that the file does not exist and return a
correct error, instead of handling an exception.

Well, that will for example not working for putting files. Also, there
is a proper FTP error reply for invalid requests, and I think that's
the proper thing to return for broken requests, which is what
FtpServer correctly does.


The point is that you are expecting the TextLineDecoder to detect a bad 
file name, instead of checking the file name in the IoHandler. But 
anyway, I think t's not relevant here.


The correct question is : should the TextLine decoder throw an exception 
if there is a wrong byte in the incoming bytes, or should it swallow the 
wrong byte, and let the String constructor replace this wrong byte by a 
'?' char...


Would we say : we should throw an exception, then the patch works, and 
that solve your issue as a side effect .


Should we do that ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



CMS migration

2012-09-24 Thread Emmanuel Lécharny

Hi guys,

in order to migrate the Confluence based site to CMS, we may have to 
shuffle around a few things in the repository.


The current layout on Subversion is :

all/
asyncweb/
branches/
ftpserver/
metadata/
sandbox/
sshd/
tags/
trunk/
vysper/
KEYS

We could change a few things here. What I suggest is that we move the 
all/, branches/, tags/ and trunl/ directories under a mina/ main 
directory. Also the metadata/ directory should be removed, its contain 
being moved to each associated project.


Regarding the site repository, I suggest to create a site/ base 
directory, under wich we will have all the projects site (I will create 
it atm, but it can be changed later).


wdyt ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Migration from Confluence to CMS

2012-09-26 Thread Emmanuel Lécharny

Le 9/26/12 8:25 AM, Ashish a écrit :

Tried my first step. Main page is coming up, but I still don't
understand the CMS system completely. Trying to get a hang of it.

We also need to raise a JIRA for Infra to have staging environment to be setup.


https://issues.apache.org/jira/browse/INFRA-5313

We are waiting for it to be ready...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



UDP improvements

2012-09-26 Thread Emmanuel Lécharny

Hi guys,

those last days, I spent some time on the UDP server, and I found many 
places where we can improve the bare MINA performances.


I have already applied a few patches :
- The boundHandles field was a Map, storing the channel 
associated with a socketAddress using a String. This String was created 
using the getAddressAsString method. It has been removed, and we now use 
the SocketAddress as a key in the map (note that we already do that for TCP)
- We were creating a IoBuffer to read a datagram from the channel, with 
a fixed size (the buffer were to be large enough to store the biggest 
possible Datagram). That's ok, but we then created another IoBuffer to 
store just the Datagram bytes, discarding the bytes after the first 
buffer limit. This was a totally spurious operation : I removed the 
creation of this second buffer.


Those fixes led to a visible speedup : for a test I'm using, I was able 
to go down from 29 secs to 17 secs.


But there is more.

The IoSessionRecycler class is used to avoid creating new sessions for 
UDP clients when they connect. It makes sense, as this is a disconnected 
protocol, to keep a session associated with a remote host. The problem 
is that we store those sessions using an Object containing the remote 
and local address :


...
session = sessionRecycler.recycle(localAddress, remoteAddress);
...

public IoSession recycle(SocketAddress localAddress,
SocketAddress remoteAddress) {
return sessionMap.get(generateKey(localAddress, remoteAddress));
}

and

private Object generateKey(SocketAddress localAddress,
SocketAddress remoteAddress) {
List key = new ArrayList(2);
key.add(remoteAddress);
key.add(localAddress);
return key;
}

This is extremely costly. It represents 17% of the whole time.

My perception is that it makes no sense to use the localAddress as a 
part of the session key, we should only use the remoteKey. Doing so save 
11% (down from 17% to 6%).


Last, not least, we have some potential gain in some other areas. For 
instance, we have a hierarchy where the NioDatagramAcceptor inherit from 
AbstractPollingConnectionlessIoAcceptor, and the processReadySessions() 
method which is in the abtstract class calls many methods in the 
NioDatagramAcceptor. That's not bad per se, except that the 
processReadySessions() method iterates on the channels :


private void processReadySessions(Iterator handles) {
while (handles.hasNext()) {
H h = handles.next();
handles.remove();

try {
if (isReadable(h)) {
readHandle(h);
}

if (isWritable(h)) {
for (IoSession session : 
getManagedSessions().values()) {

scheduleFlush((S) session);
}
}
} catch (Throwable t) {
ExceptionMonitor.getInstance().exceptionCaught(t);
}
}
}

where the Iterator is an instance of DatagramChannelIterator :

private static class DatagramChannelIterator implements 
Iterator {


private final Iterator i;

private DatagramChannelIterator(Collection keys) {
this.i = keys.iterator();
}

public boolean hasNext() {
return i.hasNext();
}

public DatagramChannel next() {
return (DatagramChannel) i.next().channel();
}

public void remove() {
i.remove();
}

}


The problem is that the isReadable() and isWritable() methods need to 
get the SelectionKey associated to the channel :


protected boolean isReadable(DatagramChannel handle) {
SelectionKey key = handle.keyFor(selector);

if ((key == null) || (!key.isValid())) {
return false;
}

return key.isReadable();
}

So we do a SelectionKey -> channel conversion, followed by a channel -> 
SelectionKey conversion (called twice, one in isReadable, on in isWritable)/



We can most certainly move all this code in the NioDatagramChannel 
class, and save some extra CPU.


Note that I have already removed the DatagramChannelIterator class, to 
use an iterator over the SeelctionKeys :


private void processReadySessions(Set handles) {
Iterator iterator = handles.iterator();

while (iterator.hasNext()) {
H handle = (H) iterator.next().channel();
iterator.remove();

...

and it also saves a few %...

Ok, that's pretty much it for today, feel free to comment.

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: svn commit: r1390943 - in /mina/site/trunk/content: contributors.mdtext issue_tracking.mdtext

2012-09-27 Thread Emmanuel Lécharny
oing on and what is expected instead, in 
English of course. It does not have to be perfect english - most of the 
committers aren't English native's speaker  - but at least something we can 
understand.
+* A short description in the title.
+* Last, not least, if you are kind enough to propose a patch, attach it and 
__do not forget to check the box which grant The ASF the right to apply it in 
the code base.__
+
+Remember that this issue tracking system is public. Would you provide some 
confidential information, it will be visbile to the world. Keep that in mind 
before posting !!!
+
+# Available projects
+
+Issues, bugs, and feature requests should be submitted to the following issue 
tracking system :
+
+
+
+
+ Project 
+ JIRA key 
+ Corresponding link to issue tracking system 
+
+
+ AsyncWeb 
+ ASYNCWEB 
+ http://issues.apache.org/jira/browse/ASYNCWEB"; class="external-link" 
rel="nofollow">http://issues.apache.org/jira/browse/ASYNCWEB 
+
+
+ FTPServer 
+ FTPSERVER 
+ http://issues.apache.org/jira/browse/FTPSERVER"; 
class="external-link" rel="nofollow">http://issues.apache.org/jira/browse/FTPSERVER 
+
+
+ MINA 
+ DIRMINA 
+ http://issues.apache.org/jira/browse/DIRMINA"; class="external-link" 
rel="nofollow">http://issues.apache.org/jira/browse/DIRMINA 
+
+
+ SSHd 
+ SSHD 
+ http://issues.apache.org/jira/browse/SSHD"; class="external-link" 
rel="nofollow">http://issues.apache.org/jira/browse/SSHD 
+
+
+ Vysper 
+ VYSPER 
+ http://issues.apache.org/jira/browse/VYSPER"; class="external-link" 
rel="nofollow">http://issues.apache.org/jira/browse/VYSPER 
+
+
+





--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] Release SSHD 0.8.0

2012-09-27 Thread Emmanuel Lécharny

Le 9/25/12 2:56 PM, Guillaume Nodet a écrit :

I've uploaded a release at
  https://repository.apache.org/content/repositories/orgapachemina-037/

The release notes are available at

https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310849&version=12321700

The tag is available at
  http://svn.apache.org/repos/asf/mina/sshd/tags/sshd-0.8.0/

The key file is available at
  http://svn.apache.org/repos/asf/mina/KEYS

The vote will be opened for at least 72 hours.  Please review and vote.


Revision ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: websocket codec in Apache Mina

2012-09-27 Thread Emmanuel Lécharny

Le 9/12/12 7:25 PM, Dhruv Chopra a écrit :

Hi,


Hi,

seems like the following message didn't made it to the mailing list ( 
can't find it in 
http://mail-archives.apache.org/mod_mbox/mina-dev/201209.mbox/browser), 
although I have it in my mailbox... Very strange !


" Thanks for your responses regarding this. I have created a new
JIRA<https://issues.apache.org/jira/browse/DIRMINA-907 
<https://issues.apache.org/jira/browse/DIRMINA-907>>concerning

this.
To answer Emmanuel's earlier question, yes we (Shephertz) are willing to
provide support for this filter.
We are code complete for this feature and are doing some validation. Apart
from the filter code, what else (eg: sample usage, client code) would we
needed?

Thanks!
"


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: websocket codec in Apache Mina

2012-09-27 Thread Emmanuel Lécharny

Ok, seems like my mail GUI is just totally dumb...

Thanks fot the JIRA. The next step would be to attach your code to it, 
and to allow us to use it under the Apache License 2.0.


Whatever code you have is ok (ie, tests, samples,etc).

Any documentation could help too, but as we are redesigning teh web ite, 
it's not really convenient to get anything but a reame.txt atm.


As soon as we can see the code, and play with it, we will interact 
through the JIRA for comments and suggestion.


Many thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Site migration : status

2012-09-28 Thread Emmanuel Lécharny

Hi guys,

Ashish is doing an excellent work, migrating pages one after the other ! 
Hopefully, we should be able to get the sites moved in the next two weeks.


We will keep the wiki available, but it won't be the base for the sites.

There are many pages that we may want to remove, or refactor. Let's see 
what has to be done project by project.


MINA


1.x will be decommisionned, so we just need to have a page for the 
archive downloads, and probably a link to the wiki.


Navigation :
o We will keep a link on the latest versions (MINA 2.0.5, FtpServer 
1.0.6, Sshd 0.7.0 and Vysper 0.7).
o Not sure we need to keep a 'projects' item, as we already have them on 
the header
o The documentation list is messy. We should probably link to each 
project documentation, and get rid of Features, Road Map, and FAQ.
o The Resources list is way too long. We should probably split it into 
two sub-items : resources and Support.
- Resources would contain Testimonials, Arcticle, Conférences, 
Performances and related projects
- Support would contain Downloads, Mailing list, Issue Tracking, Sources 
and Developpers guide

o Community is ok
o We should hide the 'Upcomming' item, if we have nothing to announce.

Documentation :
We should keep what Ashish has worked on last year, ie the user guide. 
We could also add some MINA in 5 minutes and MINA IN 10 minutes, but I'd 
rather have some decent tutorials in the User Guide.

We also need a decent FAQ.

Everything else, like MINA 3.0 design, class diagrams, etc belongs to 
the wiki.



FtpServer
-

The site is totally different, and we may design a new layout, which 
looks like the one we have for MINA, Vysper and Sshd. It would be best 
if the header were to use a specific lok-go instead of the MINA logo, 
with another color (see what we have done on directory.apache.org and 
the subprojects, like http://directory.apache.org/studio/ and 
http://directory.apache.org/api/)


The navigation page could also mimic the MINA's one


Sshd


It would be cool to have a specific image for the project. When we are 
on the web site, nothing obvious tells that it's teh SSHD site :/


Same comment for the navigation than for FtpServer


Vysper
--

The Vysper logo would be better on top, replacing the MINA logo. The 
navigation could also mimic the MINA's one



AsyncWeb


As the project is really in its infAncy, and not very active, we could 
just design a limited version of the site, with a banner indicating that 
it's still a on going work.



Please feel free to comment !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: IoProcessor & write operations

2012-09-28 Thread Emmanuel Lécharny


I have made a little experiment in UDP :
- I added the write(Session, WriteRequest) method in the IoProcessor
interface
- in the DefaultIoFilterChain.HeadFilter.filterWrite() method, I check
if the write queue is empy, and if so, I call the write(Session,
WriteRequest) method instead of pushing the WriteRequest into a queue,
adding the session into the list of sessions to flush, and calling the
flush(session) method
- as the IoProcessor interface has changed, I have also added the
implementing classes, and in order to work even if the write queue is
empty, I copied the existing code from the HeadFilter.filterWrite()
method there, so the other protocols still work the same way

The result is quite interesting : it's eating 20% less CPU than when we
were going through a queue.

I also compared the UDP performance test on 2.0.4 and trunk :
- it takes 34.3 seconds, and uses 45% CPU with MINA 2.0.4 to run this test
- it takes 25.88 seconds, and uses 30% CPU on trunk.

Baseline, MINA consume less CPU and time with the changes done on trunk,
leaving more 'room' for applications to execute.

This is true for UDP, but if we except the write part, on TCP the code
is a bit better, and there is not such an order of improvement to
expect. However, we could spare some cycles by writing directly in the
socket, if it's ready.

Two last points :
o Statistics are quite expensive to generate, it could be a good idea to
have them disabled by configuration
o If the application des not care about the messageSent() event, then we
should be able to tell the server that we don't want to receive such a
message. That could save a few CPU too.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com






Re: Mina HTTP on Mina 2.0.4

2012-09-28 Thread Emmanuel Lécharny

Le 9/28/12 4:26 PM, Arnaud bourree a écrit :

Issue DIRMINA-909


Thanks !

I'll give it a look this week-end, and see if it can be integrated 
before the next release.



Btw, have you looked at Asyncweb ? http://mina.apache.org/asyncweb/

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: ApacheCon EU

2012-09-28 Thread Emmanuel Lécharny

Le 9/28/12 4:59 PM, Julien Vermillard a écrit :

Hi !

I'm going to ApacheCon EU this year.

Is there some other MINA enthusiasts who plan to go there ?


Maybe maybe...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Do we really need the all directory?

2012-09-29 Thread Emmanuel Lécharny

Le 9/29/12 8:01 PM, Alan D. Cabrera a écrit :

Seems like overkill.  Anyone mind if I remove it and move trunk/tags/branches 
into a new mina directory?

No, go ahead (if nobody objects -lazzy consensus, etc...).


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Do we really need the all directory?

2012-10-01 Thread Emmanuel Lécharny

Le 10/1/12 7:17 AM, Ashish a écrit :

Alan,

Please update the Wiki as of now. We are still in the process of
migrating to new CMS, and as of now none of MINA pages have been
migrated as of now.


Just FTR, the wiki will remain, but will not be the base for our 
websites. So if you have to add some new pages in Confluence, feel free 
to do so.


We are still waiting for infra to create the staging repository. I'll 
ping them this week.



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] Release SSHD 0.8.0

2012-10-01 Thread Emmanuel Lécharny

Le 10/1/12 12:20 PM, Guillaume Nodet a écrit :

Fwiw, we're still missing 2 binding votes for this release.



Only one, if we count you and me as voters...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[MINA 3.0] Thoughts on TCP server

2012-10-01 Thread Emmanuel Lécharny
memory load, as we will have to wait until all 
the reads are done, storing all the data to be written in the mean time, 
until we are done with the last session.


5) MINA events
Atm, we are processing the following events :
- messageReceived (when we have read some data from the channel)
- messageSent (when a user message has been sentcompletely)
- exceptionCaugth (when an exception has been caught)
- sessionIdle (if the session has not received or sent anything for a 
period of time)

- sessionCreated (when a new session is created)
- sessionOpened
- sessionClosed (when the session has been closed)
- filterWrite
- filterClose

The sessionOpened, filterWrite and filterClose are a bit mysterious. I 
don't see why we need a special event SessionOpened when we alreayd have 
the sessionCreated event. That may seems we *may* create a session, but 
not accept any incoming or outgoing messages for this session, until 
it's initialized. I'm not sure this is necessary.


The two other events are probably some YAGNY iplementation...

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Do we really need the all directory?

2012-10-01 Thread Emmanuel Lécharny

Le 10/1/12 6:47 AM, Alan D. Cabrera a écrit :

On Sep 29, 2012, at 8:28 PM, Emmanuel L�charny wrote:


Le 9/29/12 8:01 PM, Alan D. Cabrera a �crit :

Seems like overkill.  Anyone mind if I remove it and move trunk/tags/branches 
into a new mina directory?

No, go ahead (if nobody objects -lazzy consensus, etc...).


I need to update the documentation and any hudson jobs we have.  How does out 
new CMS system work these days?


Crap... The move breaks the build :/

I'm gonna fix that.

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[VOTE] MINA 2.0.6 Release

2012-10-01 Thread Emmanuel Lécharny

Hi !
We are ready for a new release of MINA. This is a bug fix release, which 
solve an API regression introduced in MINA 2.0.5, and we have a real 
improvement in the UDP part.


A temporary tag has been created (it can be removed if the vote is not
approved):http://svn.apache.org/viewvc/mina/mina/tags/2.0.6/

The newly approved Nexus has been used for the preparation of this 
release and

all final artifacts are stored in a staging repository:
https://repository.apache.org/content/repositories/orgapachemina-070/

The subversion revision for the tag is : 1392283
http://svn.apache.org/viewvc?rev=1392283&view=rev

The sources distributions are available for download on :
https://repository.apache.org/content/repositories/orgapachemina-070/org/apache/mina/mina-parent/2.0.6/

Let's vote :
[ ] +1 | Release MINA 2.0.6
[ ] ±0 | Abstain
[ ] -1  | Do*NOT* release MINA 2.0.6


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] Release SSHD 0.8.0

2012-10-01 Thread Emmanuel Lécharny

Le 9/25/12 2:56 PM, Guillaume Nodet a écrit :

I've uploaded a release at
  https://repository.apache.org/content/repositories/orgapachemina-037/

The release notes are available at

https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310849&version=12321700

The tag is available at
  http://svn.apache.org/repos/asf/mina/sshd/tags/sshd-0.8.0/

The key file is available at
  http://svn.apache.org/repos/asf/mina/KEYS

The vote will be opened for at least 72 hours.  Please review and vote.


+1

Although there is a .gitignore file in the root directory that should be 
added into svn:ignore, and the rat plugin should also be configured to 
ignore the pom files and various other files in sshd-core :

 !? /sshd-core/src/test/resources/dsaprivkey.pem
 !? /sshd-core/src/test/resources/hostkey.pem
 !? 
/sshd-core/src/test/resources/org/apache/sshd/common/util/stty-output-1.txt
 !? 
/sshd-core/src/test/resources/org/apache/sshd/common/util/stty-output-2.txt



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] MINA 2.0.6 Release

2012-10-01 Thread Emmanuel Lécharny

Le 10/1/12 4:01 PM, Julien Vermillard a écrit :

finally -1 :

Running org.apache.mina.transport.socket.nio.DatagramSessionIdleTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.028 sec
<<< FAILURE!


Damn it... Seems like it passes on OSX, but not on Ubuntu :/



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Fwd: [Cancel] vas: [VOTE] MINA 2.0.6 Release

2012-10-01 Thread Emmanuel Lécharny


Le 10/1/12 4:13 PM, Emmanuel Lécharny a écrit :

Le 10/1/12 4:01 PM, Julien Vermillard a écrit :

finally -1 :

Running org.apache.mina.transport.socket.nio.DatagramSessionIdleTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.028
sec
<<< FAILURE!


Damn it... Seems like it passes on OSX, but not on Ubuntu :/


There is a failure due to some IPV4/IPV6 address mismatches. I'll try to
get it fixed asap.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com






Re: Fwd: [Cancel] vas: [VOTE] MINA 2.0.6 Release

2012-10-01 Thread Emmanuel Lécharny

Le 10/1/12 4:43 PM, Emmanuel Lécharny a écrit :


Le 10/1/12 4:13 PM, Emmanuel Lécharny a écrit :

Le 10/1/12 4:01 PM, Julien Vermillard a écrit :

finally -1 :

Running org.apache.mina.transport.socket.nio.DatagramSessionIdleTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.028
sec
<<< FAILURE!


Damn it... Seems like it passes on OSX, but not on Ubuntu :/


There is a failure due to some IPV4/IPV6 address mismatches. I'll try to
get it fixed asap.



So the problem is that when we bind on the server using this address :

InetSocketAddress bindAddress = new 
InetSocketAddress(AvailablePortFinder.getNextAvailable());


(which is 0.0.0.0:XYZT)

the server create the DatagramChannel :

protected DatagramChannel open(SocketAddress localAddress) throws 
Exception {

final DatagramChannel c = DatagramChannel.open();
boolean success = false;
try {
new NioDatagramSessionConfig(c).setAll(getSessionConfig());
c.configureBlocking(false);
c.socket().bind(localAddress);
c.register(selector, SelectionKey.OP_READ);
success = true;
} finally {
if (!success) {
close(c);
}
}

return c;
}

and then store the channel's address in the boundedHandles map :

for (SocketAddress socketAddress : localAddresses) {
H handle = open(socketAddress);
newHandles.put(localAddress(handle), handle);
}

boundHandles.putAll(newHandles);


Here, the localAddress(handle) method does :

protected SocketAddress localAddress(DatagramChannel handle) throws 
Exception {

return handle.socket().getLocalSocketAddress();
}

which returns 0:0:0:0:0:0:0:0:XYZT, an IPV6 address :/

So we have now an IPV6 address stored in the map, but when we do in the 
test :


IoSession session = acceptor.newSession(
new InetSocketAddress("127.0.0.1", 
AvailablePortFinder.getNextAvailable()), bindAddress);



the bindAddress is an IPV4 address, it it won't be found :/

If anyone has an idea on how to fix that properly...

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Fwd: [Cancel] vas: [VOTE] MINA 2.0.6 Release

2012-10-01 Thread Emmanuel Lécharny

Le 10/1/12 6:27 PM, Emmanuel Lécharny a écrit :

Le 10/1/12 4:43 PM, Emmanuel Lécharny a écrit :


Le 10/1/12 4:13 PM, Emmanuel Lécharny a écrit :

Le 10/1/12 4:01 PM, Julien Vermillard a écrit :

finally -1 :

Running org.apache.mina.transport.socket.nio.DatagramSessionIdleTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.028
sec
<<< FAILURE!


Damn it... Seems like it passes on OSX, but not on Ubuntu :/


There is a failure due to some IPV4/IPV6 address mismatches. I'll try to
get it fixed asap.



So the problem is that when we bind on the server using this address :

InetSocketAddress bindAddress = new 
InetSocketAddress(AvailablePortFinder.getNextAvailable());


(which is 0.0.0.0:XYZT)

the server create the DatagramChannel :

protected DatagramChannel open(SocketAddress localAddress) throws 
Exception {

final DatagramChannel c = DatagramChannel.open();
boolean success = false;
try {
new NioDatagramSessionConfig(c).setAll(getSessionConfig());
c.configureBlocking(false);
c.socket().bind(localAddress);
c.register(selector, SelectionKey.OP_READ);
success = true;
} finally {
if (!success) {
close(c);
}
}

return c;
}

and then store the channel's address in the boundedHandles map :

for (SocketAddress socketAddress : localAddresses) {
H handle = open(socketAddress);
newHandles.put(localAddress(handle), handle);
}

boundHandles.putAll(newHandles);


Here, the localAddress(handle) method does :

protected SocketAddress localAddress(DatagramChannel handle) 
throws Exception {

return handle.socket().getLocalSocketAddress();
}

which returns 0:0:0:0:0:0:0:0:XYZT, an IPV6 address :/

So we have now an IPV6 address stored in the map, but when we do in 
the test :


IoSession session = acceptor.newSession(
new InetSocketAddress("127.0.0.1", 
AvailablePortFinder.getNextAvailable()), bindAddress);



the bindAddress is an IPV4 address, it it won't be found :/

If anyone has an idea on how to fix that properly...



FTR, this test is working perfectly well on Mac OSX, and on Windows. It 
just fails on Ubuntu (Java 1.6.0_33 n my server)


Anyone can test the code on any other Linux box ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[VOTE] MINA 2.0.6 Release, take 2

2012-10-02 Thread Emmanuel Lécharny


Hi !
We are ready for a new release of MINA. This is a bug fix release, which
solve an API regression introduced in MINA 2.0.5, and we have a real
improvement in the UDP part.

A temporary tag has been created (it can be removed if the vote is not
approved):http://svn.apache.org/viewvc/mina/mina/tags/2.0.6/

The newly approved Nexus has been used for the preparation of this
release and
all final artifacts are stored in a staging repository:
https://repository.apache.org/content/repositories/orgapachemina-078/

The subversion revision for the tag is : 1392839
http://svn.apache.org/viewvc?rev=1392839&view=rev

The sources distributions are available for download on :
https://repository.apache.org/content/repositories/orgapachemina-078/org/apache/mina/mina-parent/2.0.6/

Let's vote :
[ ] +1 | Release MINA 2.0.6
[ ] ±0 | Abstain
[ ] -1  | Do*NOT* release MINA 2.0.6


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com






[Result][VOTE] MINA 2.0.6 Release, take 2

2012-10-05 Thread Emmanuel Lécharny

Hi,

the vote passed with 4+1 (3 binding) :
Julien, Guillaume and me, plys Jeff (non binding)

I will release MINA 2.0.6 now.

Many thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Bad news : [Result][VOTE] MINA 2.0.6 Release, take 2

2012-10-05 Thread Emmanuel Lécharny

Hi guys,

sometime, sh*t happens. Just a few hours after I closed the vote, and of 
course after I moved all the jars to people.apache.org, I just 
discovered a bad bug in the UDP part I modified... This is a blocker for 
Apache Directory Server (more specifically for the Kerberos server which 
uses UDP), so I will have to cut a new release asap.


I will not announce the 2.0.6 release, and the web site will not expose 
this version either.


I'm currently conducting some more tests, and will try to add a new test 
to cover the loophole we have in the unit tests.


Sorry for the inconvenience...

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[VOTE] MINA 2.0.7 Release

2012-10-05 Thread Emmanuel Lécharny


Hi !

as the latest release (2.0.6) contained two blocking bugs (a SSL 
regression introduced in 2.0.5 and another regression in the UDP 
connector/acceptor intruduced in 2.0.6), a new release has been issued 
to fix those two issues.


The http code pushed by Arnaud Bourée has been injected as a separate 
module in this release too.



A temporary tag has been created (it can be removed if the vote is not
approved):http://svn.apache.org/viewvc/mina/mina/tags/2.0.7/

The newly approved Nexus has been used for the preparation of this 
release and

all final artifacts are stored in a staging repository:
https://repository.apache.org/content/repositories/orgapachemina-097/

The subversion revision for the tag is : 1394870
http://svn.apache.org/viewvc?rev=1394870&view=rev

The sources distributions are available for download on :
https://repository.apache.org/content/repositories/orgapachemina-097/org/apache/mina/mina-parent/2.0.7/

Let's vote :
[ ] +1 | Release MINA 2.0.7
[ ] ±0 | Abstain
[ ] -1  | Do*NOT* release MINA 2.0.7


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com




--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [VOTE] MINA 2.0.7 Release

2012-10-06 Thread Emmanuel Lécharny

[X] +1 | Release MINA 2.0.7

FYI, I ran Vysper, SSHd, Asyncweb and FtpServer with 2.0.7, all tests 
are passing.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[Result] [VOTE] MINA 2.0.7 Release

2012-10-08 Thread Emmanuel Lécharny

Hi,

we have had 4 +1 binding votes, one non binding +1 :

Guillaume,
Julien,
Niklas,
and me (all binding)
Jeff (non binding).

I will publish the new packages and update the site in the next couple 
of days.


Many thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com




Re: [VOTE] Release SSHD 0.8.0

2012-10-09 Thread Emmanuel Lécharny
It's been ore than 10 days this vote is opened, Guillaume, are you going 
to close it ?



Le 9/27/12 2:16 PM, Guillaume Nodet a écrit :

+1

On Tue, Sep 25, 2012 at 2:56 PM, Guillaume Nodet  wrote:


I've uploaded a release at
  https://repository.apache.org/content/repositories/orgapachemina-037/

The release notes are available at

https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310849&version=12321700

The tag is available at
  http://svn.apache.org/repos/asf/mina/sshd/tags/sshd-0.8.0/

The key file is available at
  http://svn.apache.org/repos/asf/mina/KEYS

The vote will be opened for at least 72 hours.  Please review and vote.

--

Guillaume Nodet

Blog: http://gnodet.blogspot.com/

FuseSource, Integration everywhere
http://fusesource.com







--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Web site updated after MINA 2.0.7 and SSHd 0.8.0 releases

2012-10-10 Thread Emmanuel Lécharny

Hi guys,

I just updated the wiki pages for those two releases.

I have added a SSHD 0.8.0 page, which needs to be completed with the 
list of fixed issues.


I siwh this is the last time we use Confluence for such a task !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



JIRA spams...

2012-10-10 Thread Emmanuel Lécharny

Hi,

sorry for the many JIRA messages, I forgot to click on the check box 
that tells JIRA not to send a mail for every single issue being changed 
during a bulk change...


It's sad that this check box is not set to 'no' as a default...

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Bulk changes of JIRA issues

2012-10-10 Thread Emmanuel Lécharny

Le 10/10/12 1:31 PM, Bernd Fondermann a écrit :

Hi Emmanuel,

you might already know this: if you choose "Tools"/"Bulk change" on a
list of JIRA issues, you can suppress sending an email at the last
step of the workflow.

Yes, I just click on 'finish' too fast...

It's plain stupid that the option is not set to false by default :/


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Web site updated after MINA 2.0.7 and SSHd 0.8.0 releases

2012-10-10 Thread Emmanuel Lécharny

Le 10/10/12 1:41 PM, Ashish a écrit :

+1

SSHD and Vysper site have been migrated (logos are pending)

Planning to finish FTP server in next 2 days. Would be great if
someone can help me in verifying things

I'm currently reviewing the whole site, and migrating the MINA pages.

In order to avoid too much overlap, the best would be to commit 
frequently. I will not step in FtpServer on my side.


I'll work out something for the Logo. I suggest we use a different color 
schema for each project :

- deep purple for MINA
- green for FtpServer
- red for Sshd
- yellow for Vysper
- gray for Asyncweb

wdyt ?

Thanks !


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Web site updated after MINA 2.0.7 and SSHd 0.8.0 releases

2012-10-10 Thread Emmanuel Lécharny

Le 10/10/12 5:10 PM, Ashish a écrit :

On Wed, Oct 10, 2012 at 7:21 PM, Emmanuel L�charny  wrote:

Le 10/10/12 1:41 PM, Ashish a �crit :


+1

SSHD and Vysper site have been migrated (logos are pending)

Planning to finish FTP server in next 2 days. Would be great if
someone can help me in verifying things

I'm currently reviewing the whole site, and migrating the MINA pages.

In order to avoid too much overlap, the best would be to commit frequently.
I will not step in FtpServer on my side.

+1, I am done with FtpServer as well. Hope I have not missed any page.
If I work on it, I shall try to commit pages as soon as I finish them
so that we don't duplicate the effort.


I'll work out something for the Logo. I suggest we use a different color
schema for each project :
- deep purple for MINA
- green for FtpServer
- red for Sshd
- yellow for Vysper
- gray for Asyncweb

wdyt ?

+1 Also to simplify things we can refactor header to remove navigation
link and add to page.html. It shall make things easy to intergrate

There is one issue in right now, the menu bar is not coming on main
mina pages, coz of condition added in header.html to include specific
nav bar.

I shall try to pick up this work again in a day or so, once I catch up
with my paid work :)


Okie, i'm currently cleaning up the mainpage and the navigation !

Thanks !


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



SSHd CMS site completed

2012-10-11 Thread Emmanuel Lécharny

Hi guys,

Ashish has converted the whole SSHd site to CMS, and I reviewed the 
pages : it's all ok now.


Two pages have to be completed :
- faq
- features

Right now, they just contain a big TODO...

Those pages are available on 
http://svn.apache.org/repos/asf/mina/site/trunk/content/sshd/faq.mdtext 
and features.mdtext.


It would be cool if someone can fill them up !

Also SSHd does not have any logo. It would be cool if someone could come 
with a logo based on what we already have for MINA? Vysper and FtpServer.


Thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[ANNOUNCE] Apache MINA 2.0.7 released

2012-10-12 Thread Emmanuel Lécharny

The Apache MINA project is pleased to announce MINA 2.0.7 ! This
version is a bug fix release.

Apache MINA is a network application framework which helps users
develop high performance and high scalability network applications
easily by providing an abstract, event-driven, asynchronous API over
various transports such as TCP/IP and UDP/IP vis Java NIO.

The Apache MINA project website includes resources such as
introductory presentation slides, tutorials, and examples to help you
learn MINA as soon as possible.

This version fixes a few errors found since we released 2.0.5,
including some regression that has been fixed.

Download :
=
 *http://mina.apache.org/downloads.html

Quick links :
==
* Homepage -http://mina.apache.org/
* FAQ -http://mina.apache.org/faq.html
* Testimonials -http://mina.apache.org/testimonials.html
* Documentation -http://mina.apache.org/documentation.html
* Performance -http://mina.apache.org/performance-test-reports.html

We recommend all users to upgrade to this release. We consider this a
stable and production ready release.

Release notes :
=


Bug

  * DIRMINA-645 <https://issues.apache.org/jira/browse/DIRMINA-645>- 
SslFilter should start initiating handshake from sesionCreated() rather 
than from onPostAdd()
  * DIRMINA-617 <https://issues.apache.org/jira/browse/DIRMINA-617> - 
JMX - IoServiceMBean doesn't expose IoService statistics
  * DIRMINA-671 <https://issues.apache.org/jira/browse/DIRMINA-671> - 
AbstractPollingIoProcessor useless check for empty message


Improvement

  * DIRMINA-839 <https://issues.apache.org/jira/browse/DIRMINA-839> - 
The AvailablePortFinder is overly complex



New features
  * DIRMINA-499 <https://issues.apache.org/jira/browse/DIRMINA-499> - 
Bindings for Scala




The Apache MINA PMC


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Vysper and FTPServer CMS site conversion completed

2012-10-12 Thread Emmanuel Lécharny

Hi guys,

we are done wth the conversion of the Vysper and FtpServer conversion. 
Please feel free to have a look at the result, which are stored in :


http://svn.apache.org/repos/asf/mina/site/trunk/content/vysper
http://svn.apache.org/repos/asf/mina/site/trunk/content/ftpserver

Still no staging site available :/

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



MINA site conversion : current status

2012-10-12 Thread Emmanuel Lécharny

Hi guys,

I listed all the existing pages on the current site, and checked their 
status on the CMS. Here is the result :


+ : Page done
x : Page removed
- : Todo
> : Being converted
c : Remains in Confluence
? : What to do with this page ?

Index

+Contact
+Mailing Lists
+Contributors
?Documentation
xArtwork
xMINA Theme
cAsynchronous File IO in Java
xChanges Between 2.x and 1.x
cClass Diagrams
cCodec Repository
cCode Metrics
cConfiguring Thread Model
+Developer Guide
-Setting SVN Properties in TortoiseSVN Client
cHandling Packet Fragementation
cIntegrating with Spring
cLogging Configuration
xMINA 2.0 Documentation TODO
cMINA 3.0 design
cMINA 3.0 HTTP Codec
cMINA 3 messages processing
cMINA 3 Service
cMINA 3 Session
cMINA Internals
cIoProcessor loop
cStartup Sequence
-MINA v2.0 Quick Start Guide
?Quick Start Guide
+User Guide
+Chapter 1 - Getting Started
+NIO Overview
+Features
+First Steps
+Chapter 1 - Summary
+Chapter 2 - Basics
+MINA based Application Architecture
+Client Architecture
+Server Architecture
+Sample TCP Server
+Sample TCP Client
+Sample UDP Server
+Sample UDP Client
+Chapter 2 - Summary
+Chapter 3 - Service
+IoService introduction
+IO Service
+Chapter 4 - Session
+Chapter 5 - Filters
>IoFilter
>NoopFilter discussion
>ProfilerTimerFilter discussion
>ErrorGeneratingFilter Tutorial
+Chapter 6 - Transports
+APR Transport
+Serial Tutorial
>UDP Tutorial
+Chapter 7 - Handler
>IoHandler
+Chapter 8 - Acceptor
+Chapter 9 - Connector
+Chapter 10 - IoBuffer
>IoBuffer
+Chapter 11 - Codec Filter
>Tutorial on ProtocolCodecFilter (for Mina 2.x)
+Chapter 12 - Executor Filter
>Using an Executor Filter
+Chapter 13 - SSL Filter
+Chapter 14 - Logging Filter
+Chapter 15 - Debugging
+Chapter 16 - State Machine
+Chapter 17 - Proxy
+Chapter 18 - JMX Integration
+Chapter 19 - Spring Integration
xDonations
cLoggingFilter discussion
cMdcInjectionFilter discussion
cProtocolCodec discussion
+Downloads
cTutorial on ProtocolCodecFilter (for MINA 1)
+FAQ
+Issue Tracking
+Performance Test Reports
+Related Projects
+Road Map
+Testimonials
cTraffic throttling

+ Navigation
+Conferences
+Sources

x Site Template


All in all, there are around 10 pages that requires to be migrated, so 
this should be done by the end of this week.


A couple of pages should probably be reshuffled in some other, the pages 
marked '?'. The documentation page should contain a pointer to the user 
guide and to the Quick Start Guide.


Otherwise, I think we can add some useful 10 mins tutorials for some 
simple tasks, exposing some very simple pieces of code.


Last, not least, the asyncweb pages are totally absent atm. We have a 
pointer on this sub-project, I will probably create the associated pages 
for completness.


Thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



MINA Site svnpubsub migration...

2012-10-16 Thread Emmanuel Lécharny

Hi guys,

I have requested the migration of the MINA confluence base site to use 
the CMS last month (sept, 24th, see 
https://issues.apache.org/jira/browse/INFRA-5313).


The site pages have been converted to markdown, and is now ready to be 
switched, but as of today, we don't have access to the staging site, so 
it's quite hard for the committers to review the pages and fix them, if 
needed...


It would be great if the staging site and everything related could be 
available asap, so that we can polish everything on a online site.


Many thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: patch for sshd handling of message-less IOExceptions

2012-10-16 Thread Emmanuel Lécharny

Le 10/16/12 5:35 PM, Peter Nagy a écrit :

Just a small patch so that IOExceptions from filesystem won't generate NPE
(if I need to send it somewhere else, or there are some additional
procedures to do, please tell)

tegla
Sadly, the attachment didn't make it to the mailing list (it was 
discarded by the spam checker).


the best would be to attach the patch to a JIRA !

Thanks a lot and sorry for the inconvenience...

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: MIAN site naming convention

2012-10-16 Thread Emmanuel Lécharny

Le 10/17/12 1:33 AM, sebb a écrit :

On 16 October 2012 18:24, Emmanuel Lécharny  wrote:

Hi guys,

I have tried to uniformize the file names : I replaced all the '_' by '-'
(at least for MINA pages).
I hope that I didn't break anything...

Apart from the subject of this e-mail?


carp ! It was proabbly too laet wehn I snet it !


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



CMS site

2012-10-22 Thread Emmanuel Lécharny

Hi guys,

I have updated all the user guide pages so that you can now navigate 
using a scrollbar on top and bottom of each page. It's easy : you just 
have to define 5 properties on top of eahc page :


NavUp: ../user-guide-toc.html
NavUpText: User Guide
NavPrev: ../ch8-acceptor/ch8-acceptor.html
NavPrevText: Chapter 8 - Acceptor
NavNext: ../ch10-iobuffer/ch10-iobuffer.html
NavNextText: Chapter 10 - IoBuffer

Here, the NavUp and NavUpText contain the link and title of the parent 
page, Navprev and NavPrevText contain the link and texte of the previous 
page, etc.


I will add some more scrollbar in the internal pages.

There are many pages that need to be improved.

Pages with no content :
---

Chapter-13 : SSL Filter
Chapter-15 : Debugging
Chapter-17 : Proxy

Page that need to be completed :

Chapter 6 : Transports (We have nothing about TCP/UDP/in-VM)
Chapter 10 : IoBuffer (Most of the page is about MINA 3...)
Chapter 12 : Executor Filter (*very* very light...)

Some pages we might want to add :
-
- A page about configuration
- A page about codecs in the first part (separated from the Codec Filter 
page)

- A page about Future
- A page about reading and writing messages
- A page about statistics
- A page about Streams
- A page about the Firewall and Keepalive filters
- A page about compression

If you feel you can give an hand, that would be much appreciated !


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: [jira] [Commented] (DIRMINA-907) Create a WebSocket iofilter for use in Apache Mina TCP servers

2012-10-23 Thread Emmanuel Lécharny

Le 10/23/12 11:53 AM, Dhruv Chopra a écrit :

Hi Folks,

Wanted to check if anyone has had a chance to play with the code we
submitted for this filter.
In case some information is incomplete, please let me know.

Looking forward to your feedback.


Sorry, I was stuck in MINA release (2.0.7) and two other Apache releases...

Now that 2.0.7 is out, I'm focusing on the site and documentation, but I 
will definitively look at your code !


Thanks for the polling and sorry for the delay !


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: ACEU anyone ?

2012-10-23 Thread Emmanuel Lécharny

Le 10/23/12 2:34 PM, Bernd Fondermann a écrit :

On 23.10.12 14:27, Emmanuel Lécharny wrote:

Hi guys,

I'll be in Sinsheim in 2 weeks for ACEU, I know that Julien will be
there, are there any other MINA committers or users expecting to be
there ? It would be cool if we can have a kind of un-conference or
barcamp, and share beers or any other beverage (including sodas !)

Thanks !


I'm on a different conference that week. It's a pity since Sinsheim is 
not far away. If you're in transit through Frankfurt, give me a shout.


  Bernd


Sadly, I'll transit through Mannheim...

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: ACEU anyone ?

2012-10-23 Thread Emmanuel Lécharny

Le 10/23/12 3:14 PM, Bernd Fondermann a écrit :

On Tue, Oct 23, 2012 at 3:02 PM, Julien Vermillard
 wrote:


Hi,
I'll be be there,
Bernd you transit through Frankfurt airport ?

No, I live in Frankfurt. I'd be there most of the week, except for
those days where I'm in Munich. Though I had the time to go to
ApacheCon EU, tickets only sell for the whole week, which makes me not
wanting to go because I can only attend one day or so.


It's only 40€ for the full week, for committers !


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: ACEU anyone ?

2012-10-23 Thread Emmanuel Lécharny

Le 10/23/12 5:08 PM, Bernd Fondermann a écrit :

On 23.10.12 16:58, Bernd Fondermann wrote:

On 23.10.12 15:25, Emmanuel Lécharny wrote:

Le 10/23/12 3:14 PM, Bernd Fondermann a écrit :

On Tue, Oct 23, 2012 at 3:02 PM, Julien Vermillard
 wrote:


Hi,
I'll be be there,
Bernd you transit through Frankfurt airport ?

No, I live in Frankfurt. I'd be there most of the week, except for
those days where I'm in Munich. Though I had the time to go to
ApacheCon EU, tickets only sell for the whole week, which makes me not
wanting to go because I can only attend one day or so.


It's only 40€ for the full week, for committers !


IS IT? wowzers. I'm sold. I didn't expect the discount to be that huge,
so I didn't even check!


booked. I'll be there on selected days, at least Thursday.

great ! :)



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Do we need to keep the AbstractPollingConnectionlessIoAcceptor class at all ?

2012-10-23 Thread Emmanuel Lécharny

Hi,

just wondering if it would not be a better idea to simply merge the 
AbstractPollingConnectionlessIoAcceptor and NioDatagramAcceptor classes 
? We are *very* unlikely to extend the

AbstractPollingConnectionlessIoAcceptor class anyway...

thoughts ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Do we need to keep the AbstractPollingConnectionlessIoAcceptor class at all ?

2012-10-23 Thread Emmanuel Lécharny

Le 10/23/12 7:34 PM, Julien Vermillard a écrit :

I think we have too many abstract layer, so one less is a good idea


Done. Quite easy. Many lacking Javadoc though :/ /me going to work on 
that ...



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Confluence note/warning/tips in markdown pages

2012-10-26 Thread Emmanuel Lécharny

Hi guys,

just to inform you that I modified the common.css file so hat it's now 
freaking easy to add the Confluence {note}. Here is how it works :


When you have a Confluence note like :
{note:title=Be Careful}
The links will redirect you to a list of the nearest mirrors, if a 
mirror hasn't got the latest version yet due to propagation delay you 
can try another one.

{note}

you have to add this code in your markdown file :


Be Careful
The links will redirect you to a list of the nearest mirrors, if a 
mirror hasn't got the latest version yet due to propagation delay you 
can try another one.



(you can use the "tip", "info", "note" or "warning" class).

Also note - as strange has it is - that the  tag must be UPPERCASED !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: new SSH client

2012-10-30 Thread Emmanuel Lécharny

Hi Guillaume,

we had similar problem when we designed the LDAP API, but we decided to 
change the way users should get data, depending on the mode. 
Asynchronous mode is not really expected to be the main mode by the 
average Joe user, so we made the getSession() a synchronous method, and 
we added a getAsyncSession() method for those who wanted to get a Future 
and deal with it later.


Would it be an option for SSHd ?


Le 10/30/12 9:38 AM, Guillaume Nodet a écrit :

The API is asynchronous.
You need to use

ClientSession session = client.connect(host, port).await().getSession();

On Mon, Oct 29, 2012 at 6:38 PM, Jonathan Welzel  wrote:


I have been trying to set up a SSH Client using SSHD, but I'm unable to
obtain a session from the client. It's always null.

SshClient client = SshClient.setUpDefaultClient();
client.start();
ClientSession session = client.connect("10.47.10.57", 22).getSession(); //
session is always null

I'm able to connect using Putty, so what's wrong?

--
Jonathan Welzel







--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: The MINA staging site is up an running

2012-10-31 Thread Emmanuel Lécharny

Le 10/31/12 10:17 AM, Niklas Gustavsson a écrit :

On Wed, Oct 31, 2012 at 6:48 AM, Emmanuel Lécharny  wrote:

the new MINA site (markdwon based) is ready for review on
http://mina.staging.apache.org/.

It also covers the FtpServer, SSHd and Vysper sites.

You can review it, and even fix things that you like, everything is
available on mina/site/trunk.

Awesome stuff, so much nicer than Confluence. Did a quick review:

* Links seems to add an extra / on each page traversal, perhaps this
is something due to the staging site?
Do you have an example ? There are some references to some apache pages 
(like http://www.apache.org/licenses/) which have a final / (that can be 
removed). I don't think that the final '/' are generated otherwise, they 
are present in the pages.

* http://mina.staging.apache.org/vysper/download.html is missing

Fixed

* Capitalization of SSHD is different in the main menu and on the SSHD pages.


I never know if the name should be SSHD or SSHd. As soon as one is 
selected (I must say that I like SSHd a lot), I can grep and sed the 
whole site to fix that. Guillaume ?



Thanks for the review ! Also feel free to install the envirnment to be 
able to fix the pages and to check locally what it gives (I will draft a 
mail soon today explaining how it works)


Btw, the asyncweb site is currently empty, I'm not sure if we should 
keep it or not atm.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: The MINA staging site is up an running

2012-10-31 Thread Emmanuel Lécharny

Le 10/31/12 2:06 PM, Niklas Gustavsson a écrit :

On Wed, Oct 31, 2012 at 10:47 AM, Emmanuel Lécharny  wrote:

* Links seems to add an extra / on each page traversal, perhaps this
is something due to the staging site?

Do you have an example ? There are some references to some apache pages
(like http://www.apache.org/licenses/) which have a final / (that can be
removed). I don't think that the final '/' are generated otherwise, they are
present in the pages.

Clicking around a bit gives you wonderful URLs like:
http://mina.staging.apache.org//ftpserver/downloads.html.
Seems to be a double / in the relative URL in links.


Yes, I just replied in this thread about this thing. It's an extraneous 
'/' I have added after the {{base}} variable. I'm currently fixing this.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



New site dull task...

2012-10-31 Thread Emmanuel Lécharny

Hi guys,

we have around one hundred of tables to convert from HTML to Markdwon 
syntax. It's an extremelly dull work, and I'd appreciate if I can get 
some help...


Basically, markdown table syntax is pretty much the same than confluence 
syntax. Here is an exemple :


| Column | Type | Default value |
|---|---|---|
| userid | VARCHAR(64), Primary key | |
| userpassword | VARCHAR(64) | |
| homedirectory | VARCHAR(128) | |
| enableflag | BOOLEAN | TRUE |
| writepermission | BOOLEAN | FALSE |
| idletime | INT | 0 |
| uploadrate | INT | 0 |
| downloadrate | INT | 0 |
| maxloginnumber | INT | 0 |
| maxloginperip | INT | 0 |

Currently, we have simply copy/pasted the HTML tables, and we now have 
to come back to the markdown syntax.


The very same for code (Java and XML). A portion of code in markdown 
looks like :


:::Java (or :::XML)
my code

Note the tab/4 spaces in front of the code.

Currently, we have long  with various SPAN inside and @quot; or 
</> : all this crap can be removed from the pages.


Feel free to give an hand !


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Fwd: Re: New site dull task...

2012-10-31 Thread Emmanuel Lécharny


Le 10/31/12 4:30 PM, Ashish a écrit :

Will spend some time tomorrow on this.
Do you want me to target any specific section like ftpserver/vysper?


I'm on FtpServer atm. If you do Vysper, I'll more than pleased !

Btw, I restablished the Asyncweb site.

Thanks a lot Ashish !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com






FtpServer site ready

2012-10-31 Thread Emmanuel Lécharny

Hi,

I have reviewed all the pages for teh FtpServer new site 
(http://mina.staging.apache.org/ftpserver/index.html), AFAICT, it's ok.


There are no more HTML tag inside the pages, all the tables have been 
converted.


Please review it !

Thanks !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: All the new staging site pages have been fixed

2012-11-01 Thread Emmanuel Lécharny

Le 11/1/12 12:47 PM, Niklas Gustavsson a écrit :

On Thu, Nov 1, 2012 at 11:58 AM, Emmanuel Lécharny  wrote:

I finally worked like a machine and reviewed all the pages. Feel free to
review them now, and signal any formatiing problem !

* http://mina.staging.apache.org/mina/userguide/ch8-iobuffer/ch8-obuffer.html
is missing.

Fixed

* header on http://mina.staging.apache.org/mina/performances.html overlaps
Hmmm, what do you mean, when you say it 'overlaps' ? AFAICT, the page 
looks like correct to me.



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: All the new staging site pages have been fixed

2012-11-02 Thread Emmanuel Lécharny

Le 11/2/12 9:09 AM, Niklas Gustavsson a écrit :

On Fri, Nov 2, 2012 at 7:27 AM, Emmanuel Lécharny  wrote:

Le 11/1/12 12:47 PM, Niklas Gustavsson a écrit :

* header on http://mina.staging.apache.org/mina/performances.html overlaps

Hmmm, what do you mean, when you say it 'overlaps' ? AFAICT, the page looks
like correct to me.

http://i49.tinypic.com/ztew0h.png
Ok. It does not shows the same way on my laptop (FF, Chrome & Safari). 
Nevertheless, I used a "H2" instead of a "H1", just let me know if it's 
any better for you.



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: synchronous client and sever socket messaging

2012-11-05 Thread Emmanuel Lécharny

Le 11/5/12 11:37 AM, daniel vettori a écrit :

Hi,

As i am using Apace MINA in my socket component. I want to have synchronous
behaviour with the socket server and socket client while sending messages.
Right now ,I send messages directly and process based on delimiter. Is it
good to have some kind of Ack thing to work with...or work with multiple
sessions at a time.. or any other.What will be the right way to approach
for this ...??


It's up to you to define a protocol that expect some kind of ACKs.

Otherwise, I'm not sure what you are trying to do : how does working 
with multiple sessions relates to the problem you are trying to fix ?



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: synchronous client and sever socket messaging

2012-11-05 Thread Emmanuel Lécharny

Le 11/5/12 4:17 PM, daniel vettori a écrit :

suppose three clients and one server are therenow one client connects
to server..and at that time, dont want other two clients to interact with
socket server untill the processing of message based on delimiter get over
between server and the first client...
There is nothing you can do on the server to forbid a client to actually 
send some message to the server. This is a server...


What you can do is to send a message to all the clients telling them 
that they should not send a message until the server send a ack to them, 
assumin the clients *will* respect this information. Again, this is all 
related to the protocol you define, it has nothing to do with the MINA 
API or whatever IO.


This is really a bizare requirement...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



MINA web site : moving the staging to real...

2012-11-06 Thread Emmanuel Lécharny

Hi guys,

now that all the MINA sites have been migrated, I suggest we move the 
staging site to be the real site, and phase out the old confluence site.


Do you think we are ready ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: MINA web site : moving the staging to real...

2012-11-07 Thread Emmanuel Lécharny

Le 11/7/12 12:53 PM, Niklas Gustavsson a écrit :

On Tue, Nov 6, 2012 at 5:49 PM, Emmanuel Lécharny  wrote:

now that all the MINA sites have been migrated, I suggest we move the
staging site to be the real site, and phase out the old confluence site.

Do it.

Yes I can !


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



[MINA 3] messageSent events

2012-11-07 Thread Emmanuel Lécharny

Hi,

we were dscussing about the messageSent event in the recent past, 
wondering if this event was useful or not.


Today, while trying to deal with a problem on an application that gets 
some OOM when sending big messages, we started to discuss with Julien 
about the best way to solve the issue.


Basically, what happens is that an application received a request, then 
build a big response, and tries to send this big response in small 
chunks, expecting that all the chunks will be sent one by one, instead 
of being stored in a temporary queue waiting for the client socket to be 
ready. Thet does not work : everything is stored first in memory, then sent.


The reason is that the writes are processed after the reads, so if you 
try to write while processing the read, the written data will be stored 
in a queue (so in memory).


So how to deal with this problem ? In MINA 2, there are two ways :

- you keep doing this, but you add an executor in the filter chain, in 
order to have a new thread that can process the writes
- you wait for the chunk of data to be written into the socket before 
trying to write some new data


The first solution will still stress a lot our server, because writing 
data in a queue will be faster than writing the data in the socket.


The second solution requires that you wait for the messageSent event to 
send more data. In this case, your cod will look like :


messageReceived() {
data = getAChunkOfData()
session.write( data )
}

messageSent() {
data = getAChunkOfData()

if ( data != null ) {
session.write( data )
}
}


For every chunk of data completely pushed into the soccket, you will get 
a messageSent event generated. You have the guarantee that the chunks of 
data won't stay in memory.


So the important point here is that the messageSent event is mandatory, 
and we should most certainly use it in MINA 3.


Now, ther eis one more tricky part we need to rething : the WriteFuture 
usage.


Let's say one wants to do something like :


messageReceived() {
while ( ( data = getAChunkOfData() ) != null ) {
writeFuture = session.write( data )
writeFuture.get()
}
}

then you have not solved your memory issue, as the writeFuture will be 
signaled only when the chuck of data will have been added in the queue. 
If we modify the writeFuture to be signaled when the data are really 
written in the socket, then with MINA 2, you will be blocked forever, as 
the thread processing the writes is the same thred you are using to 
process the reads (and you are already using it).


That would be different if we were using a different thread for the 
selector and for the processor, something we should probably do in MINA 
3 anyway...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Mina 3.0 Sonar Profile

2012-11-08 Thread Emmanuel Lécharny

Le 11/8/12 10:01 AM, Ashish a écrit :

Does anyone know why our Sonar profile hasn't been updated since Sept 30th
2012?

http://nemo.sonarsource.org/dashboard/index/387414?did=1

I guess we haven't added any code since last september...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com



Re: Mina 3.0 Sonar Profile

2012-11-08 Thread Emmanuel Lécharny
Le 11/8/12 12:20 PM, Julien Vermillard a écrit :
> I think we changed the SVN url and added a /mina/ before the /trunk.

I have created a JIRA in order to have MINA being updated, and the other
subprojects to be added :

https://issues.apache.org/jira/browse/INFRA-5495


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: Mina 3.0 Sonar Profile

2012-11-08 Thread Emmanuel Lécharny
It's back !

https://analysis.apache.org/drilldown/violations/24437


Le 11/8/12 12:20 PM, Julien Vermillard a écrit :
> I think we changed the SVN url and added a /mina/ before the /trunk.
>
> jenkins build suffered that syndrome and automatically unactivated
>
>
> On Thu, Nov 8, 2012 at 10:39 AM, Ashish  wrote:
>
>> We did. Julien did committed some code.
>>
>> Lets see if we those changes.
>>
>>
>> On Thu, Nov 8, 2012 at 2:41 PM, Emmanuel Lécharny >> wrote:
>>> Le 11/8/12 10:01 AM, Ashish a écrit :
>>>
>>>  Does anyone know why our Sonar profile hasn't been updated since Sept
>> 30th
>>>> 2012?
>>>>
>>>> http://nemo.sonarsource.org/**dashboard/index/387414?did=1<
>> http://nemo.sonarsource.org/dashboard/index/387414?did=1>
>>> I guess we haven't added any code since last september...
>>>
>>>
>>> --
>>> Regards,
>>> Cordialement,
>>> Emmanuel Lécharny
>>> www.iktek.com
>>>
>>>
>>
>> --
>> thanks
>> ashish
>>
>> Blog: http://www.ashishpaliwal.com/blog
>> My Photo Galleries: http://www.pbase.com/ashishpaliwal
>>


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: Mina 3.0 Sonar Profile

2012-11-08 Thread Emmanuel Lécharny
Le 11/8/12 2:43 PM, Ashish a écrit : > It's 2.0.8 version.. > > The link
I sent was different (it was for trunk). I think it might have got >
broken when we changed our directory structure. > Anyways not priority,
it's definitely helpful, but not a blocker :) I have requested a sonar
instance for both MINA 2.0 and MINA 3.0. It will be done later this
afternon. Right now, the 2.0 sonar instance has been fixed and reflects
the current state. -- Regards, Cordialement, Emmanuel Lécharny
www.iktek.com





MINA 2 : a few things we can do...

2012-11-08 Thread Emmanuel Lécharny
 // Process writes
if (isWritable(session) && !session.isWriteSuspended()) {
// add the session to the queue, if it's not already there
if (session.setScheduledForFlush(true)) {
flushingSessions.add(session);  <-- Now we
inform the processor that we have something to write
}
}

As we can see in the last method, the writes can only be processed after
the read is completed, something that will never occur if the read is
blocked waiting for the write to be done...

This is a really bad situation. Not only we block the server for this
session, but we make the user think that it's the way he should write
the IoHandler code...

Sadly, there is little we can do to fix this issue as t will break the
API badly. That makes the WriteFuture totally useless, and it put the
server at risk to quickly get some OOM as every message is pushed into
an internal queue until the thread is freed.

So what can we do ?

There is one fix that can help, but it's not an ultimate solution. In
MINA 3, we should do something totally different.

The idea is to try to write in the socket immediately, instead of
transiting through a queue. Here there are three cases :
- the socket can be written, and can contain the whole message :
We are safe, the WriteFuture will immediately return.
- the socket can be written, but it will not accept the full message :
that's a problem, because the writeFuture will hang forever.
- the socket is already full. Same problem here : we will hang.

As we can see, we may get one case where the writeFuture will not block,
but there is no solution in the second case...

That let's us with one solution : the WriteFuture should *never* block.
We have to deprecate the await() methods, and clearly inform the users
not to call them.

Now, if we write directly into the socket, we will save some CPU and
some memory, as we won't have anymore to enqueue the message. We will
still enqueue it if it can't be sent because the sockaet has blocked or
is blocked.

I suggest we do something totally different : we should *never* process
a message in the selector's thread. If we have two separate threads, one
for the selector, one for the processor, then the processor can push the
message into a queue, set the selectionKey flag to OP_WRITE and wake up
the selector. This is simple, the WriteFuture will work accordingly to
the API, and we won't have any blockage.

That means we have to create one separated worker thread in the
IoProcessor to process the messages. This is doable without breaking the
API, I think.
   

Anyway, I will try to work around those ideas in the next few days to
see if it fits.

In MINA 3, we should be extremelly careful not to reproduce such
behaviors. Hopefully, Julien is doing an excellent job here, so I'm
confident that MINA 3 will be way better !

One last note : if you have injected an Executor in the chain, then
suddenly, the writeFuture will not block anymore, because the main
thread ha sbeen released and can process the write while the IoHandler
thread is waiting for the write to be done... But adding an executor in
the chain creates more problem than it solves here...

-- Regards, Cordialement, Emmanuel Lécharny www.iktek.com


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



RequestResponseFilter usage...

2012-11-09 Thread Emmanuel Lécharny
Hi,

as I was palying around the idea to get rid of most of the WriteRequest
pages, I found some code that uses it extensively, the
RequestResponseFilter class and all it's attached classes.

It seems that it's something created to solve this JIRA :

https://issues.apache.org/jira/browse/DIRMINA-92

I have looked at the code, and unless I spend a few hours to understand
what it's doing, as there is no Javadoc nor tutorial, I wonder if this
feature is useful, and if so, how it works.

The very same question has already been raised a few years ago, but I'm
still wondering if it's an interesting feature, and if it's something we
should keep it around ?

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



[MINA 3] Session write queue

2012-11-09 Thread Emmanuel Lécharny
Hi,

I have a few comments about the existing code :

1) We don't need to protect the WritQueue with a lock : it's already a
thread safe queue. Removing this lock will save a lot of contention.
2) The NioTcpSession.ready() method now calls two methods : one to
process the read, and another one to process the writes.
3) We *must* execute the read and the writes in a separate thread,
otherwise the future will block for ever if we have more than one
message to write. In fact, theready() call should be done within the
selector worker, and delegated to a separate thread :

Selector Thread Worker Thread
   |  |
+->select()   |
|   read() ---(1)--> processRead()
| |   |
| |  ... // do whatever is needed on the handler
| |   |
|   write() -(2)--> processWrites()
| |
+-+
 loop


Here, even if the worker thread is busy processing the read, and that
includes writing some data then waiting for those data to be written,
the selector thread will continue to process incoming data and outgoing
data. The communication between the Selector thread and teh Worker
thread is done through a queue of events and a notification mechanism
using the Futures.

One more thing : we should use the same Worker Thread for a given
session, otherwise we may have some problems while decoding the
messages. If the user wants to be able to process two different messages
concurrently for the same session, then it's up to this user to add an
executor in the handler.

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: [MINA 3] Session write queue

2012-11-10 Thread Emmanuel Lécharny
Le 11/10/12 9:28 AM, Julien Vermillard a écrit :
> hmm I think the queue sync was added (by you?) because even if it's a
> conncurent queue, the write registration could fail if a thead write in
>  the queue while the selector loop write it.

That's possible I added the lock, I don't reember, but sounds like I
could have been that paranoiac ;). However, there is no reason for the
selector to write in the queue. My understanding is that the
ConcurrentQueue is fully thread safe, so you can still read and write
data fromm it safely.

Have I missed something ?


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: [MINA 3] Session write queue

2012-11-10 Thread Emmanuel Lécharny
Le 11/10/12 10:52 AM, Emmanuel Lécharny a écrit :
> Le 11/10/12 9:28 AM, Julien Vermillard a écrit :
>> hmm I think the queue sync was added (by you?) because even if it's a
>> conncurent queue, the write registration could fail if a thead write in
>>  the queue while the selector loop write it.
> That's possible I added the lock, I don't reember, 

http://svn.apache.org/viewvc?rev=1210888&view=rev

Thunderbird has a better memory that I do :)




-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: [MINA 3] Session write queue

2012-11-10 Thread Emmanuel Lécharny
Le 11/10/12 8:42 PM, Julien Vermillard a écrit :
> I think a simple spin lock would be much faster than plain java lock,
> because we have two thread sharing short time locked resource, the thread
> wanting to lock can loop a little it will receive the lock very quickly. In
> case of a java lock the thread will be candidate for context switching and
> I'm not sure it's a good idea for write performance.
The ConcurrentLinkedList already use something else than a plain java
lock (see http://www.cs.rochester.edu/u/michael/PODC96.html, which is
the base for its implementation)


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: [MINA 3] Session write queue

2012-11-11 Thread Emmanuel Lécharny
Le 11/11/12 8:19 AM, Julien Vermillard a écrit :
> yes but the problem in fact is to lock the socket write flag
>
Is that an issue at all ? We can't set the socket flag while waiting for
the select() to complete, so it's done outside fo the select() call,
thus while the selectionLoop thread is dealing with the queue. There is
no other thread manipulating this flag.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: [MINA 3] Session write queue

2012-11-11 Thread Emmanuel Lécharny
Le 11/11/12 10:03 AM, Julien Vermillard a écrit :
> when the I/O selector code :
>  - queue.isEmpty() ?
>  - set write flag off
>
> write thread code :
>  - queue.add(message)
>  - set write flag on

Thanks for the heads up.

I had in mind the fact that the write thread queue should not set the
flag. The selector thread should instead set the flag when the queue is
not empty. The only thing the write thread queue should do is to wake up
the selector when it pushes some message in the queue.

Doing so remove all the potential concurrency issue, but it has a few
drawbacks (see below)

We can see the time line for such operations :

T0 : selector thread select() is waked up because a read event occured.
T1 : the selector thread call the messageReceived() event
T2 : the selector thread goes to sleep (no more event to proceed) | T2 :
the session thread processes the messageReceived() event
T3 : the selector thread still sleeps | T3 : the session thread write
some message, push it into the write queue, and wakeup the selector thread
T4 : the selector thread is awakened, sees that there is some messages
to write in the queue, try to write them and if it can't write them all,
set the OP_WRITE event

That should work. The only problem here is to know which writeQueue to
check.

Now, I can see how such a scenario can be seen as not perfect : though
it get rid of any concurrency issue, it forces the selector thread to
either check all the sessions to see if there is some messages in their
writeQueue (that assumes we have one writeQueue per session) *or* we use
one single writeQueue for *all* the sessions, and we don't have any
problem at all, except that we will have to process all the messages in
this queue, and not the first ones -not an ideal scenario, as we will
have many messages blocked, and this would require some huge
modification in the queue-.

So maybe my scenario is not perfect... Maybe we should let the write
thread set the OP_WRITE flag, but I don't know if this is possible when
the select() is blocked ?

One other possible option would be to have a second queue
-writingSessionQueue- (this queue would be shared between the selector
thread and the writer threads), containing the sessions that have
written something in their message queue. Doing so, the Selector thread
would check this queue, and for each session, will try to write the
pending messages, thus setting the OP_WRITE itself.

This third option is probably the best I can foresee, and it does not
need any other lock than the one provided by the writingSessionQueue.

wdyt ?



Second point : by-passing the writequeue
In most of the case, we won't have any pending message (or partial
message) waiting for the socket to be ready for write, and then, we
should be able to write directly into the socket, without having to push
the message into a queue. That means the session thread should be able
to write into the channel, and if the message can't be written
completely, then push it into the writeQueue.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: [MINA 3] Session write queue

2012-11-11 Thread Emmanuel Lécharny
Le 11/11/12 11:02 AM, Julien Vermillard a écrit :
> does  a simple lock on a quickly unlock resource between two thread is
> really an issue ? sometimes a lock or a spin lock is much more efficient
> than message passing around and thread wakeuping (context switching).
>
> I think we should keep the lock and focus on the queue bypassing which is
> probably a high gain.
Let me think a bit more about it tonite (3 hours train...).



-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



Re: [MINA 3] Session write queue

2012-11-11 Thread Emmanuel Lécharny
Le 11/11/12 10:03 AM, Julien Vermillard a écrit :
> when the I/O selector code :
>  - queue.isEmpty() ?
>  - set write flag off
>
> write thread code :
>  - queue.add(message)
>  - set write flag on

There are 6 possible cases :
1) QIE, SWFOFF, QA, SWFON : OK
2) QIE, QA, SWFOFF, SWFON : OK
3) QIE, QA, SWFON, SWFOFF : problem
4) QA, QIE, SWFOFF, SWFON : OK
5) QA, QIE, SWFON, SFWOFF : can't happen
6) QA, SWFON, QIE, SWFOFF : can't happen

The only problematic case is (3).
If we want to fix that, we sure need some kind of synchronization
between the two threads. What if we have an atomic boolean flag shared
between the two threads, that said the write thread has switch the write
flag to true (the write thread is the only one to set it to true, the
selector thread just switch it to false) ?

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 



<    1   2   3   4   5   6   7   8   9   10   >