Re: Infinite loop in Apache Directory Server when using MINA 2.2.1

2022-08-10 Thread Jonathan Valliere
Was the fix in Mina or Directory?

On Wed, Aug 10, 2022 at 5:34 AM Emmanuel Lécharny 
wrote:

> I confirm. I built the LDAP API with Java 11 targetting Java 8, but it's
> not enough.
>
> Fixed in trunk.
>
> On 30/07/2022 10:23, Emmanuel Lécharny wrote:
> > Seems like it's an issue with a mixed Java version being used: the lib
> > built with Java 11 and running tests in Java 8, or something like that.
> >
> > Still investigating.
> >
> > On 30/07/2022 10:03, Emmanuel Lécharny wrote:
> >> Hi,
> >>
> >>
> >> I'm currently investiagting some infinite loop in Apache DS when
> >> setting up a LDAPS server. I have no idea what's going on atm - but I
> >> will keep you posted.
> >>
> >>
> >> Here is the trace I get when doing a kill -3:
> >>
> >>
> >> "NioProcesso--
> > *Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
> > T. +33 (0)4 89 97 36 50
> > P. +33 (0)6 08 33 32 61
> > emmanuel.lecha...@busit.com https://www.busit.com/
>
> --
> *Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
> T. +33 (0)4 89 97 36 50
> P. +33 (0)6 08 33 32 61
> emmanuel.lecha...@busit.com https://www.busit.com/
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
> For additional commands, e-mail: dev-h...@mina.apache.org
>
>


[jira] [Comment Edited] (SSHD-1288) Infinite loop in org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead

2022-08-10 Thread Ivan Fiorentini (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17577782#comment-17577782
 ] 

Ivan Fiorentini edited comment on SSHD-1288 at 8/10/22 11:54 AM:
-

{quote}*Fixing this is not hard, nor is writing a test case for it.*
{quote}
That is a very good news, thanks a lot Thomas !

About the planning for the release containing the fix we wait the decision of 
the release manager as you said.

In the meantime, if the the fix could be implemented and commited to github 
that would be great ! :  I should be able
to patch the version (2.8.0) in use in our application, solve the issue the 
users are experiencing , postpone the application of the official "MINA SSHD" 
release containing the fix  when it is ready.
Do you think it is possible to proceed in this manner ?


was (Author: JIRAUSER294011):
{quote}*Fixing this is not hard, nor is writing a test case for it.*
{quote}
That is a very good news, thanks a lot Thomas !

About the planning for the release containing the fix we wait the decision of 
the release manager as you said.

In the meantime, if the the fix could be implemented and commited to github 
that would be great ! :  I should be able
to patch the version (2.8.0) in use in our application and solve the issue the 
users are experiencing and postpone the application of the official "MINA SSHD" 
release containing the fix  when it is ready.
Do you think it is possible to proceed in this manner ?

> Infinite loop in org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead
> -
>
> Key: SSHD-1288
> URL: https://issues.apache.org/jira/browse/SSHD-1288
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ivan Fiorentini
>Assignee: Thomas Wolf
>Priority: Major
> Attachments: image-2022-08-05-17-08-55-698.png
>
>
> I reported an  infinite loop  in 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead:
> and after the production of a thread and system dump the  point in execution 
> was:
> {code:java}
> private long doRead(long max, BufferConsumer consumer) throws IOException {
> long orgOffset = clientOffset;
> while (max > 0) {
> if (hasNoData()) {
> if (eofIndicator) {
> break;
> }
> if (!pendingReads.isEmpty()) {
> fillData();
> }
> if (!eofIndicator) {
> sendRequests(); <- (do not send any request ! it does nothing 
> !)
> }
> } else {
> int nb = (int) Math.min(max, buffer.available());
> consumer.consume(new ByteArrayBuffer(buffer.array(), 
> buffer.rpos(), nb));
> buffer.rpos(buffer.rpos() + nb);
> clientOffset += nb;
> max -= nb;
> }
> }
> return clientOffset - orgOffset;
> }
> {code}
>  
> In the system dump it seems the size of file to receive  is obtained before 
> to start the transfer... this size is 82.132.992 bytes; but during the 
> receipt of the data it seems (at the time of the dump) that 82.156.760 was 
> successfully received... *_this could happen if , during the file receipt, at 
> the remote site the file is written (expanded) with more data._*
> ... but when the size of the received data is greater than the original it 
> seems an infinite loop could happen in the 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead when the 
> sendRequests() is invoked to obtain more data (or receive the end of file);
> In the sendRequest():
> {code:java}
> while (pendingReads.size() < Math.max(1, windowSize / bufferSize)
>&& (fileSize <= 0 || requestOffset < fileSize + bufferSize)) {
>
>... do the send request to obtain more data (or to receive the end of 
> file)  
> requestOffset += bufferSize;
> }
> {code}
>  ... the condition *requestOffset < fileSize + bufferSize* 
> is not satisfied if the *requestOffset* >= *fileSize + bufferSize*
> preventing the code from sending a request to receive more data (and/or 
> obtain the end of file) and causing the infinite loop.
> The values of the above variables at time of the dump was:
> !image-2022-08-05-17-08-55-698.png!
> ... so that "{*}(fileSize <= 0 || requestOffset < fileSize + bufferSize)"{*} 
> is {color:#de350b}*FALSE*{color}
> To reproduce the problem:
>  # create the remote file to receive (1Mb size)
>  # create SftpClient sftp = 
> DefaultSftpClientFactory.NSTANCE.createSftpClient(clientSession)
>  # create InputStream is = sftp.read(file, 32768) end read the inputstrem 4kb 
> at time
>  # stop at the end of while loop block in 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#sendRequests
> when the requestOffset > fileSize
> 

[jira] [Comment Edited] (SSHD-1288) Infinite loop in org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead

2022-08-10 Thread Ivan Fiorentini (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17577782#comment-17577782
 ] 

Ivan Fiorentini edited comment on SSHD-1288 at 8/10/22 11:53 AM:
-

{quote}*Fixing this is not hard, nor is writing a test case for it.*
{quote}
That is a very good news, thanks a lot Thomas !

About the planning for the release containing the fix we wait the decision of 
the release manager as you said.

In the meantime, if the the fix could be implemented and commited to github 
that would be great ! :  I should be able
to patch the version (2.8.0) in use in our application and solve the issue the 
users are experiencing and postpone the application of the official "MINA SSHD" 
release containing the fix  when it is ready.
Do you think it is possible to proceed in this manner ?


was (Author: JIRAUSER294011):
{quote}*Fixing this is not hard, nor is writing a test case for it.*
{quote}
That is a very good news, thanks a lot Thomas !

About the planning for the release containing the fix we wait the decision of 
the release manager as you said.

In the meantime, if the the fix could be implemented and commited to github 
that would be great ! :  I' should be able
to patch the version (2.8.0) in use in our application and solve the issue the 
users are experiencing and postpone the application of the official "MINA SSHD" 
release containing the fix  when it is ready.
Do you think it is possible to proceed in this manner ?

> Infinite loop in org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead
> -
>
> Key: SSHD-1288
> URL: https://issues.apache.org/jira/browse/SSHD-1288
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ivan Fiorentini
>Assignee: Thomas Wolf
>Priority: Major
> Attachments: image-2022-08-05-17-08-55-698.png
>
>
> I reported an  infinite loop  in 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead:
> and after the production of a thread and system dump the  point in execution 
> was:
> {code:java}
> private long doRead(long max, BufferConsumer consumer) throws IOException {
> long orgOffset = clientOffset;
> while (max > 0) {
> if (hasNoData()) {
> if (eofIndicator) {
> break;
> }
> if (!pendingReads.isEmpty()) {
> fillData();
> }
> if (!eofIndicator) {
> sendRequests(); <- (do not send any request ! it does nothing 
> !)
> }
> } else {
> int nb = (int) Math.min(max, buffer.available());
> consumer.consume(new ByteArrayBuffer(buffer.array(), 
> buffer.rpos(), nb));
> buffer.rpos(buffer.rpos() + nb);
> clientOffset += nb;
> max -= nb;
> }
> }
> return clientOffset - orgOffset;
> }
> {code}
>  
> In the system dump it seems the size of file to receive  is obtained before 
> to start the transfer... this size is 82.132.992 bytes; but during the 
> receipt of the data it seems (at the time of the dump) that 82.156.760 was 
> successfully received... *_this could happen if , during the file receipt, at 
> the remote site the file is written (expanded) with more data._*
> ... but when the size of the received data is greater than the original it 
> seems an infinite loop could happen in the 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead when the 
> sendRequests() is invoked to obtain more data (or receive the end of file);
> In the sendRequest():
> {code:java}
> while (pendingReads.size() < Math.max(1, windowSize / bufferSize)
>&& (fileSize <= 0 || requestOffset < fileSize + bufferSize)) {
>
>... do the send request to obtain more data (or to receive the end of 
> file)  
> requestOffset += bufferSize;
> }
> {code}
>  ... the condition *requestOffset < fileSize + bufferSize* 
> is not satisfied if the *requestOffset* >= *fileSize + bufferSize*
> preventing the code from sending a request to receive more data (and/or 
> obtain the end of file) and causing the infinite loop.
> The values of the above variables at time of the dump was:
> !image-2022-08-05-17-08-55-698.png!
> ... so that "{*}(fileSize <= 0 || requestOffset < fileSize + bufferSize)"{*} 
> is {color:#de350b}*FALSE*{color}
> To reproduce the problem:
>  # create the remote file to receive (1Mb size)
>  # create SftpClient sftp = 
> DefaultSftpClientFactory.NSTANCE.createSftpClient(clientSession)
>  # create InputStream is = sftp.read(file, 32768) end read the inputstrem 4kb 
> at time
>  # stop at the end of while loop block in 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#sendRequests
> when the requestOffset > 

Re: Infinite loop in Apache Directory Server when using MINA 2.2.1

2022-08-10 Thread Emmanuel Lécharny
I confirm. I built the LDAP API with Java 11 targetting Java 8, but it's 
not enough.


Fixed in trunk.

On 30/07/2022 10:23, Emmanuel Lécharny wrote:
Seems like it's an issue with a mixed Java version being used: the lib 
built with Java 11 and running tests in Java 8, or something like that.


Still investigating.

On 30/07/2022 10:03, Emmanuel Lécharny wrote:

Hi,


I'm currently investiagting some infinite loop in Apache DS when 
setting up a LDAPS server. I have no idea what's going on atm - but I 
will keep you posted.



Here is the trace I get when doing a kill -3:


"NioProcesso-- 

*Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
T. +33 (0)4 89 97 36 50
P. +33 (0)6 08 33 32 61
emmanuel.lecha...@busit.com https://www.busit.com/


--
*Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
T. +33 (0)4 89 97 36 50
P. +33 (0)6 08 33 32 61
emmanuel.lecha...@busit.com https://www.busit.com/

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (SSHD-1288) Infinite loop in org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead

2022-08-10 Thread Ivan Fiorentini (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17577782#comment-17577782
 ] 

Ivan Fiorentini commented on SSHD-1288:
---

{quote}*Fixing this is not hard, nor is writing a test case for it.*
{quote}
That is a very good news, thanks a lot Thomas !

About the planning for the release containing the fix we wait the decision of 
the release manager as you said.

In the meantime, if the the fix could be implemented and commited to github 
that would be great ! :  I' should be able
to patch the version (2.8.0) in use in our application and solve the issue the 
users are experiencing and postpone the application of the official "MINA SSHD" 
release containing the fix  when it is ready.
Do you think it is possible to proceed in this manner ?

> Infinite loop in org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead
> -
>
> Key: SSHD-1288
> URL: https://issues.apache.org/jira/browse/SSHD-1288
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ivan Fiorentini
>Assignee: Thomas Wolf
>Priority: Major
> Attachments: image-2022-08-05-17-08-55-698.png
>
>
> I reported an  infinite loop  in 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead:
> and after the production of a thread and system dump the  point in execution 
> was:
> {code:java}
> private long doRead(long max, BufferConsumer consumer) throws IOException {
> long orgOffset = clientOffset;
> while (max > 0) {
> if (hasNoData()) {
> if (eofIndicator) {
> break;
> }
> if (!pendingReads.isEmpty()) {
> fillData();
> }
> if (!eofIndicator) {
> sendRequests(); <- (do not send any request ! it does nothing 
> !)
> }
> } else {
> int nb = (int) Math.min(max, buffer.available());
> consumer.consume(new ByteArrayBuffer(buffer.array(), 
> buffer.rpos(), nb));
> buffer.rpos(buffer.rpos() + nb);
> clientOffset += nb;
> max -= nb;
> }
> }
> return clientOffset - orgOffset;
> }
> {code}
>  
> In the system dump it seems the size of file to receive  is obtained before 
> to start the transfer... this size is 82.132.992 bytes; but during the 
> receipt of the data it seems (at the time of the dump) that 82.156.760 was 
> successfully received... *_this could happen if , during the file receipt, at 
> the remote site the file is written (expanded) with more data._*
> ... but when the size of the received data is greater than the original it 
> seems an infinite loop could happen in the 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#doRead when the 
> sendRequests() is invoked to obtain more data (or receive the end of file);
> In the sendRequest():
> {code:java}
> while (pendingReads.size() < Math.max(1, windowSize / bufferSize)
>&& (fileSize <= 0 || requestOffset < fileSize + bufferSize)) {
>
>... do the send request to obtain more data (or to receive the end of 
> file)  
> requestOffset += bufferSize;
> }
> {code}
>  ... the condition *requestOffset < fileSize + bufferSize* 
> is not satisfied if the *requestOffset* >= *fileSize + bufferSize*
> preventing the code from sending a request to receive more data (and/or 
> obtain the end of file) and causing the infinite loop.
> The values of the above variables at time of the dump was:
> !image-2022-08-05-17-08-55-698.png!
> ... so that "{*}(fileSize <= 0 || requestOffset < fileSize + bufferSize)"{*} 
> is {color:#de350b}*FALSE*{color}
> To reproduce the problem:
>  # create the remote file to receive (1Mb size)
>  # create SftpClient sftp = 
> DefaultSftpClientFactory.NSTANCE.createSftpClient(clientSession)
>  # create InputStream is = sftp.read(file, 32768) end read the inputstrem 4kb 
> at time
>  # stop at the end of while loop block in 
> org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#sendRequests
> when the requestOffset > fileSize
>  # expand the remote file size to 2Mb
>  # remove the stop at point 4 and continue
>  # {color:#ffbdad}the code enter into an infinite loop{color}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org