Re: Reading multiple channels under the same session

2019-01-30 Thread Andreas Schneider
On Wednesday, 30 January 2019 23:34:32 CET g4-l...@tonarchiv.ch wrote: > On 30.01.19 22:50, Alberto Garcia wrote: > > Hi, > > > > what about waiting to call ssh_event_remove_fd() > > until my_channel_close_function() is reached? > > We have to remove the socket fd from the poll event in the same

Re: Reading multiple channels under the same session

2019-01-30 Thread Alberto Garcia
That's probably happening because the python code is creating too many connections at the same time right? But, yes, as you said that looks like somewhere in your code you are forgetting to close the fd of the sockets that already did his job. On Wed, Jan 30, 2019 at 3:29 PM wrote: >

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
till@elite:~/libssh$ ssh user@localhost -p2022 -D 11223 -N user@localhost's password: accept: Too many open files accept: Too many open files accept: Too many open files I call this a success... Don't ask me how many sessions were open at the same time. But it's probably also because not all

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
On 30.01.19 22:50, Alberto Garcia wrote: > Hi, > > what about waiting to call ssh_event_remove_fd() > until my_channel_close_function() is reached? We have to remove the socket fd from the poll event in the same loop round when it's closed. We should avoid polling on a closed handle. It's all a

Re: Reading multiple channels under the same session

2019-01-30 Thread Alberto Garcia
Hi, what about waiting to call ssh_event_remove_fd() until my_channel_close_function() is reached? On Wed, Jan 30, 2019 at 1:48 PM Alberto Garcia wrote: > Hi, > So it is not something specific from Windows that needs to be changed > right? > > Good gob finding the root cause! :applause: > > On

Re: Reading multiple channels under the same session

2019-01-30 Thread Alberto Garcia
Hi, So it is not something specific from Windows that needs to be changed right? Good gob finding the root cause! :applause: On Wed, Jan 30, 2019 at 1:40 PM wrote: > I have found the issue. And I have an idea how to solve it... But it needs > a bit of a redesign of the whole channel / data

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
I have found the issue. And I have an idea how to solve it... But it needs a bit of a redesign of the whole channel / data handling. The problem is that I call  ssh_event_remove_fd() in the callback function, which in turn de-registers this very callback function... This could have worked in a

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
On 30.01.19 20:09, Alberto Garcia wrote: > Andreas, You can use Till example in this thread along with this > commands for the  ssh client: >  ssh -vvv -o StrictHostKeyChecking=no -D 0.0.0.0:11223 >  10.104.1.115 -p -N > > and to make it crash just run: > > import

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
I think we face two different problems: One is related to my shaky code only. But the second one could be indeed related to polling and blocking on Windows. Till On 30.01.19 19:18, Alberto Garcia wrote: > We think it is because of a problem with libssh. Andreas maybe you can > bring some light

Re: Reading multiple channels under the same session

2019-01-30 Thread Alberto Garcia
Andreas, You can use Till example in this thread along with this commands for the ssh client: ssh -vvv -o StrictHostKeyChecking=no -D 0.0.0.0:11223 10.104.1.115 -p -N and to make it crash just run: import requests > import threading > def do_request(): > while 1: > resp =

Re: Reading multiple channels under the same session

2019-01-30 Thread Alberto Garcia
We think it is because of a problem with libssh. Andreas maybe you can bring some light to spot the bug? On Wed, Jan 30, 2019, 6:19 AM On 30.01.19 09:27, Andreas Schneider wrote: > > On Friday, January 25, 2019 3:26:10 PM CET g4-l...@tonarchiv.ch wrote: > >> On 24.01.19 22:09, Alberto Garcia

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
On 30.01.19 09:27, Andreas Schneider wrote: > On Friday, January 25, 2019 3:26:10 PM CET g4-l...@tonarchiv.ch wrote: >> On 24.01.19 22:09, Alberto Garcia wrote: >>> Can you please post the link to the mentioned code? >>> Thanks >> Here you go. > Hi Till, > > if you send it as a patch I'm happy to

Re: Reading multiple channels under the same session

2019-01-30 Thread Andreas Schneider
On Friday, January 25, 2019 3:26:10 PM CET g4-l...@tonarchiv.ch wrote: > On 24.01.19 22:09, Alberto Garcia wrote: > > Can you please post the link to the mentioned code? > > Thanks > > Here you go. Hi Till, if you send it as a patch I'm happy to add it to the examples dir. Even if the code

Re: Reading multiple channels under the same session

2019-01-29 Thread g4-lisz
On 29.01.19 22:50, g4-l...@tonarchiv.ch wrote: > Why at cb_readsock do you ssh_set_blocking(session, 0);? I revised my code... Actuall this setting to non-blocking is essential to make it work for more than one channel without threads. If ssh_channel_write() would block, the main loop would

Re: Reading multiple channels under the same session

2019-01-29 Thread g4-lisz
On 29.01.19 23:23, Alberto Garcia wrote: > Hi, > > First of all I want to clarify that I'm doing my tests in Windows so I > had to adapt the code to work in it (I modified the minimum possible > from your code). I'm worried that the problem may be in the windows > support of libssh.  > > I've

Re: Reading multiple channels under the same session

2019-01-29 Thread Alberto Garcia
Hi, First of all I want to clarify that I'm doing my tests in Windows so I had to adapt the code to work in it (I modified the minimum possible from your code). I'm worried that the problem may be in the windows support of libssh. I've been able to reproduce in a "consistent" way the crash. I

Re: Reading multiple channels under the same session

2019-01-29 Thread g4-lisz
Hi Alberto On 29.01.19 20:58, Alberto Garcia wrote: > Hi Till, > > I was finally able to adapt your code to make it work with mine. So > now I get a channel per every socks connection i'm trying to do and it > works fine and I can proxy through the session (created with -D). the > problem that

Re: Reading multiple channels under the same session

2019-01-29 Thread Alberto Garcia
Hi Till, I was finally able to adapt your code to make it work with mine. So now I get a channel per every socks connection i'm trying to do and it works fine and I can proxy through the session (created with -D). the problem that I'm facing is that the proxy doesn't work when used proxying the

Re: Reading multiple channels under the same session

2019-01-26 Thread g4-lisz
Hi Alberto Glad I could help! I advice to not use the code in production without having tested it extensiveley. I did not check for memory leaks. If you made any improvements to the code, I would appreciate when you post them here. Cheers, Till On 25.01.19 23:46, Alberto Garcia wrote: > Hi, >

Re: Reading multiple channels under the same session

2019-01-25 Thread Alberto Garcia
thanks, what is the #include "config.h" that you include at the beginning? Cheers On Fri, Jan 25, 2019 at 6:26 AM wrote: > On 24.01.19 22:09, Alberto Garcia wrote: > > Can you please post the link to the mentioned code? > Thanks > > Here you go. > > Till > > > On Thu, Jan 24, 2019, 12:47 PM

Re: Reading multiple channels under the same session

2019-01-25 Thread g4-lisz
On 24.01.19 22:09, Alberto Garcia wrote: > Can you please post the link to the mentioned code? > Thanks Here you go. Till > > On Thu, Jan 24, 2019, 12:47 PM wrote: > > On 24.01.19 21:12, Alberto Garcia wrote: > > > Hi, > > > > How can I read

Re: Reading multiple channels under the same session

2019-01-24 Thread Alberto Garcia
Can you please post the link to the mentioned code? Thanks On Thu, Jan 24, 2019, 12:47 PM On 24.01.19 21:12, Alberto Garcia wrote: > > > Hi, > > > > How can I read multiple new incoming channels under the same session > > in a libssh server? I need this since when using dynamic port > >

Re: Reading multiple channels under the same session

2019-01-24 Thread g4-lisz
On 24.01.19 21:12, Alberto Garcia wrote: > Hi, > > How can I read multiple new incoming channels under the same session > in a libssh server? I need this since when using dynamic port > forwarding and per every SOCKS5 request it creates a new channel as > you can see in this log (gotten with