-1

I have two servers, let's call them website.com and file_storage.com. (They may be located on two physically different machines, or just be a different Docker containers on one server.)

file_storage.com server stores some video files; website.com server has a feature that allows to create a playlist with some of these files and to play this playlist. For giving an access to these files I have two options (both should work):

  • Nginx, configured on file_storage.com server, that allows to receive files by links like "http://file_storage.com:8081/".
  • SSH tunnel between servers, that allows to receive files from file_storage server by links like "http://website.com:9001/".

Now, when I'm using direct access to file_storage.com, everything works fine: playlist are being played smoothly, and there are no problems with downloading and playing of a single video file.

But when I'm trying to create a playlist, using tunnels, it does not work properly. Videos may look corrupted, or they are being played faster than their real speed, or playlist may stuck at all after some video and don't play further.

So, I would like to know: what can I check to find out what goes wrong when I'm trying to play/download videos through tunnel?

Additional note: we also have a feature of playing video streams through such tunnels, and it does not have such problems. But for streams this problem has been solved by enforcing tcp protocol usage (they used udp by default). So, it should not be applicable to problem with files, because they are using tcp already.

0

So, after some investigation we have managed to find a solution; I believe I should put it here for those who will google this later.

My initial assumption was wrong; the problem was not in ssh tunnel itself.

In our code the Python library paramiko has been used to establish tunnels. And either we used it in a wrong way, or paramiko has some internal bug - but we found that when we were sending data through tunnel by calling send method of paramiko.channel.Channel, last parts of video files we tried to send were missing in the output. Changing send to sendall solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.