nova-video-player / aos-AVP

NOVA opeN sOurce Video plAyer: main repository to build them all
Apache License 2.0
3.15k stars 189 forks source link

v5.15.11 No SMB connection due to timeout on wrong IP #398

Closed JJD2K closed 3 years ago

JJD2K commented 3 years ago

v5.15.11 - does not see network with or without smb v2 enabled.

courville commented 3 years ago

OK changing resolver makes all Western Digital to timeout on SMB connectivity. Let's reopen this issue and try to fix it another way: @JJD2K and @dhlavaty I will probably need to understand why jcifs resolver does provide the wrong IP address on your network. First thing to determine: when in your LAN you try to resolve the IP address from your NAS using Broadcast or DNS, why does it return another IP. @JJD2K is your gateway IP on your ISP WAN side 192.168.25.1 ?

JJD2K commented 3 years ago

@courville No - I already wrote that. The local network has nothing to do with the WAN. The IP addresses reported for the SERVER do not exist and never existed on my network. The IPs that are displayed by that lib seem absolutely random. The WAN is not on 192.x.x.x. of course. My network is properly functioning and has nothing special in it. The router is a high-end ASUS RT-AC68U - the top model as it has some cheaper stripped-down versions. This is not my first ASUS router - I can say for home routers these are THE BEST!

Please note that the IP as I reported was different when there was no internet - it was something like 10.0.0.1 or 20.0.0.1 - I did not pay attention. The 192.168.25.1 was reported before you fixed the resolver.

It definitely is an issue with the new SMB lib - I never had such issues before.

courville commented 3 years ago

@JJD2K please bare with me a little. Your ASUS RT-AC68U is acting as a router or a passive switch? What are the IP addresses shown on web interface of the asus for the various interfaces? What I am trying to find out is if you have such a setup: Internet->|HOME GW|<-192.168.25.x->|ASUS ROUTER|<-192.168.1.x->|your PC or TV|.

JJD2K commented 3 years ago

@courville I do not get why you do not understand that 192.168.25.X DOES NOT EXIST IN MY NETWORK? 192.168.1.255 is my local network - the router works as a router. " The IP addresses reported for the SERVER do not exist and never existed on my network. "

All the devices as I initially described are on the 192.168.1.* subnet

courville commented 3 years ago

@JJD2K I do not understand why you do not try to understand what I request. I understand that the network behind you asus is 192.168.1.x (trust me I deal with gateways in my line of work) this is not what I consider there. Your asus router is connected to your home gateway (i.e. ISP router) right? What I am trying to know is what is the IP allocated to your asus from your home gateway by its internal DHCP server (not your asus DHCP server). It could be using another network i.e. not 192.168.1.x. This will be displayed on your asus router webUI. However the above points are moot if your asus router is configured as a simple bridge.

JJD2K commented 3 years ago

@courville I already replied that: "The WAN is not on 192.x.x.x. of course." Of course, the WAN uses a different IP. I answered that too: "192.168.1.255 is my local network - the router works as a router."

Honestly, I do not think that any of the above is relevant to the issue. My network is the same as for 90% of the users: WAN IP (EXTERNAL IP) -> ROUTER -> LOCAL NETWORK 192.168.1.XXX

courville commented 3 years ago

@JJD2K but the question I ask now is not about WAN IP anymore because meanwhile you mentioned your ASUS router. Let do babysteps then. How is your asus router connected to internet? Do you have another box from your ISP? If this is the case then your router does not have a WAN IP. It has the IP assigned by the DHCP server from your ISP GW. This IP address, let me think... what could it be? I will not insist anymore on the topic but I try a last time: can you please check on your asus router webUI http://192.168.1.1 and let me know what it reports?

JJD2K commented 3 years ago

That is what I was just going to clarify to you as I read your message a few times to try to understand what you miss. NO I do not have any ISP box. My router is connected to the ISP directly by LAN. That is why it has an ISP WAN IP address directly -designated by the ISP DHCP with a long lease time.

All that is absolutely irrelevant in my opinion as the issue is not when there is internet - the issue is when there is NO internet.

JJD2K commented 3 years ago

This IP address, let me think... what could it be?

That address is my WAN address and is not: 192.x.x.x. I am not listing it nor I think it is relevant to the issue.

Maybe that lib uses some internet service to resolve stuff....though that would be really dumb.

courville commented 3 years ago

OK clearer. What you miss probably is that I am not talking about the "no internet issue" that you reported. The problem faced is that the fix applied to your specific issue is causing a huge regression for other users (WD NAS users) that cannot connect anymore. Reverting the fix for this issue solves their problem. Thus I need to find another way to work around the wrong IP resolution by jcifs-ng when reverting to jcifs.resolveOrder "BCAST,DNS" instead of "LMHOSTS,DNS,WINS,BCAST". Thus it matters to me to understand why jcifs finds another network and how. I thus try to figure out what network specific topology you have. And of course I do not need your WAN address because if it is a public address, it does not matter.

JJD2K commented 3 years ago

Maybe the issues are related - I just disabled the Internet connection via the router UI and NOVA stopped working - failed to connect SERVER/10.0.0.1

JJD2K commented 3 years ago

As soon as I enabled the internet NOVA started scraping without any interaction from me (I was on the NETWORK-SERVER) page - the count appeared in the top right corner. It displayed some old stuff as recently added....the same happened last time too....

courville commented 3 years ago

@jjd2k could you please check if this apk (TEST5) https://drive.google.com/file/d/1fTmdGh5fcvAFtEdRgDbxCkt2PuNHRUcI/view?usp=sharing works in your case with respect to the very topic of this issue? I.e. to check if you have a timeout on wrong IP? adb logcat logs would help. To elaborate, this apk has the old jcifs resolvOrder (BCAST, DNS) but the nova UDP discovery injection inside jcifs-ng cache is deactivate. The purpose is thus to see if this injection is responsible of the resulting wrong IP. If this apk shows issues, I can provide a rollback apk right away to get you back into a working setup.

JJD2K commented 3 years ago

adb shell pidof -s org.courville.nova returns no PID The message is only TIME OUT - no ip.

Please provide rollback version .

courville commented 3 years ago

@JJD2K thanks for the testing and confirmation that issue is still there. The nova jcifs-ng udp cache injection is thus not the one creating issue, this is an internal jcifs-ng problem. Here is the rollback version: https://drive.google.com/file/d/13HJfx3HfjrMr9-z1r3Mp0FPTPOl3ph5K/view?usp=sharing

JJD2K commented 3 years ago

@courville ok managed to produce a log - sent to your email.

JJD2K commented 3 years ago

@courville It seems that lib jcifs has issues. You properly detect the IP and server name: 12-11 20:30:40.394 19355 20255 D TcpDiscovery: found share at 192.168.1.2 Then that stupid lib reports an incorrect IP : 12-11 20:31:41.604 19355 19472 W System.err: jcifs.smb.SmbException: Failed to connect: SEVER<20>/192.168.25.1

courville commented 3 years ago

@courville It seems that lib jcifs has issues. You properly detect the IP and server name: 12-11 20:30:40.394 19355 20255 D TcpDiscovery: found share at 192.168.1.2 Then that stupid lib reports an incorrect IP : 12-11 20:31:41.604 19355 19472 W System.err: jcifs.smb.SmbException: Failed to connect: SEVER<20>/192.168.25.1

yes indeed. It means that the error does not come from nova even with the udp discovery cache injection technique since it has been disabled in the build I shared. Thank you for the testing and log shared.

courville commented 3 years ago

@JJD2K, would you be able to run a java program directly on your pc/mac (I can provide simple instructions)? I think I can isolate the jcifs-ng part in a java program which will enable to do much quicker tests and get logs that the jcfis-ng author will request when he looks into the issue.

spiderdaz commented 3 years ago

Hi guys Spiderdaz is onboard

courville commented 3 years ago

@spiderdaz thanks for joining the party. @JJD2K is the one having another problem described in this github issue that when solving creates the regression you face. I will pack a simple java program and share it to get logs and to reproduce the issue directly on a pc. Can you please let me know the OS and java version you have installed?

spiderdaz commented 3 years ago

@courville hi, im on win10 home and java is latest update build 1.8.0_261-b12

courville commented 3 years ago

@spiderdaz and @JJD2K, I have put up a simple java test program available here https://github.com/nova-video-player/smbcli that is able to emulate nova samba browsing with jcifs-ng and able to provide extensive logs. The resulting archive is provided here: jcifsngtest.zip In order to run the program you need to have java installed and both log4j.properties (configuring the log verbosity) and jcifstest-1.0-SNAPSHOT.jar program in the same directory where you run the test via:

spiderdaz commented 3 years ago

@courville i think you need to edit out the user password in the guest login instructions!! all my devices are guest login do you need me to try making a password protected share?? how many of my shares do you need me to carry out the tests on, considering they are all displaying the same problem? limited time available due to funky shiftwork.

courville commented 3 years ago

@courville i think you need to edit out the user password in the guest login instructions!! all my devices are guest login do you need me to try making a password protected share?? how many of my shares do you need me to carry out the tests on, considering they are all displaying the same problem? limited time available due to funky shiftwork.

for guest login you can remove "" USER PASSWORD and use simply java -jar jcifstest-1.0-SNAPSHOT.jar 2 DNS smb://SERVER/ with your server name instead of SERVER. No need to setup protected shares.

courville commented 3 years ago

@spiderdaz thx for sharing the logs and performing the tests. If you do the test on the WD device that was experiencing issues, this is enough. However I do not see in the logs the timeout issues you are experiencing with DNS specified. When you remove the log4j.properties and you simply run the program to list your shares, do you see the timeout? Also what would be interesting is to list directly your folder like: java -jar jcifstest-1.0-SNAPSHOT.jar 2 DNS smb://YOURSERVER/YOURSHAREDFOLDER because the timeout issue could happen not at the root of the shares. Thanks again. You can also send me the logs privately if you wish to software at courville dot org

spiderdaz commented 3 years ago

yeah if you dont mind ill delete my last post to remove the logs let me know if you need me to resend you them. ill try with the shared folders and no without the log4j.propeties the op was the same i think ,did not see a timeout??

courville commented 3 years ago

@spiderdaz no problem I have the logs. There was nothing private anyway in the logs (it gets more private when you list your shared folders). Just to be clear on my side, I would expect that with the DNS option you get a timeout when listing shared folders. Let's see if you see that.

spiderdaz commented 3 years ago

dont think its my syntax but maybe multi word file names ,these are with folder bluray films if i just put bluray in cmd i get a return but i dont actually have that folder name. smb 1 dns output.log smb 2 bcast output.log smb 2 dns output.log smb 1 bcast output.log

spiderdaz commented 3 years ago

just experimenting making a single name folder and copying some files to it

courville commented 3 years ago

dont think its my syntax but maybe multi word file names ,these are with folder bluray films if i just put bluray in cmd i get a return but i dont actually have that folder name. smb 1 dns output.log smb 2 bcast output.log smb 2 dns output.log smb 1 bcast output.log

ah I see, perhaps you can put your share/folder between "" to escape the space in your folders

courville commented 3 years ago

@JJD2K the only test I would be interested in from you is this one java -jar jcifstest-1.0-SNAPSHOT.jar 2 BCAST smb://SERVER/SHAREDFOLDER "" USER PASSWORD 1> output.log 2>&1 where it should lead to the wrong IP. Please do not hesitate to ask for help if need be.

courville commented 3 years ago

@spiderdaz wait, it seems that the resolver is always using BCAST in the logs. I means that you are never triggering DNS resolver (and your error). I must have something wrong in my script.

EDIT: no it seems fine somehow... strange

courville commented 3 years ago

OK new set of program since the jcifs-ng author is recommending some more logging options: please use this one jcifsngtest.zip

JJD2K commented 3 years ago

@courville Hello Sent you the logs to your email. All tests seem to be working.

spiderdaz commented 3 years ago

im assuming same syntax/commands??

courville commented 3 years ago

im assuming same syntax/commands??

correct

courville commented 3 years ago

@courville Hello Sent you the logs to your email. All tests seem to be working.

thank you! I can see in the logs that the correct IP is found this time with the same options used in nova. Damn! This means that it is either Android or nova specific.

spiderdaz commented 3 years ago

more logs with new program ,using a folder named test. my cmd looks like this jcifsngtest (1)\jcifsngtest>java -jar jcifstest-1.0-SNAPSHOT.jar 2 BCAST smb://another4mycloud/test 1> output.log 2>&1 smb 1 dnsoutput.log smb 2 bcast output.log smb 2 dns output.log smb 1 bcast output.log

courville commented 3 years ago

more logs with new program ,using a folder named test. my cmd looks like this jcifsngtest (1)\jcifsngtest>java -jar jcifstest-1.0-SNAPSHOT.jar 2 BCAST smb://another4mycloud/test 1> output.log 2>&1 smb 1 dnsoutput.log smb 2 bcast output.log smb 2 dns output.log smb 1 bcast output.log

Thanks, it seems that nothing is listed as a result of the command. Could you please check that you can list your share doing the same command:

java -jar jcifstest-1.0-SNAPSHOT.jar 2 BCAST smb://another4mycloud/test

but without the log4j.properties this time to see things (and not just logs)? Perhaps this time we see the error. And perhaps it happens only with the shares and not the toplevel. We might be getting somewhere.

courville commented 3 years ago

@courville Hello Sent you the logs to your email. All tests seem to be working.

thank you! I can see in the logs that the correct IP is found this time with the same options used in nova. Damn! This means that it is either Android or nova specific.

@JJD2K, ok based on spiderdaz comment, I guess we need to check the next level on a real shared folder, can you please check:

java -jar jcifstest-1.0-SNAPSHOT.jar 2 BCAST smb://SERVER/SHAREDFOLDER "" USER PASSWORD
spiderdaz commented 3 years ago

@courville ok its finding folders /shares but only smb 2 on both settings i think smb 2 bcast.txt smb1 bcast.txt smb1 dns.txt smb2 dns.txt

courville commented 3 years ago

@courville ok its finding folders /shares but only smb 2 on both settings i think smb 2 bcast.txt smb1 bcast.txt smb1 dns.txt smb2 dns.txt

ok, thus your nas is SMB2 only which makes sense. And it is able to find files when forcing SMB2 either with DNS as first resolver or BCAST. This is exactly what does nova but apparently fails in your case when resolvOrder has DNS first.

spiderdaz commented 3 years ago

iv e just checked the newer mycloud home device (which you will recall is different from the my cloud) and the results are the same. no more help until tommorow am im afraid.,although i should be able to reply.

courville commented 3 years ago

iv e just checked the newer mycloud home device (which you will recall is different from the my cloud) and the results are the same. no more help until tommorow am im afraid.,although i should be able to reply.

Thanks for all the logs and help. If a new log is required I will ping you but for now I am clueless. Anyway in your case you can restrict yourself to do only SMB2 tests.

spiderdaz commented 3 years ago

I'll see if I can run all the tests on all devices tomorrow for completeness but I'll just remind you that all of them were failing with the last update not just the odd one like my original problems.

courville commented 3 years ago

@spiderdaz thanks for all you tests. For now I need to process everything but it seems that all is fine with jcifs-ng used from a PC and not from nova under android for some reasons. This is unfortunate. I will have to find another way to track the issue...

JJD2K commented 3 years ago

@courville Everything seems to be working properly. On my side also the shared files are listed. I think somewhere during the initialization of the libraries an incorrect IP sneaks in. Maybe uninitialized VARIABLE ....

courville commented 3 years ago

I agree that the PC track is not conclusive. Thus this must be android specific. I thus need to enabled deep logs for jcifs-ng on android. I need to figure this out. I stop bothering you for a while until I set it up properly. Thank you for your help.

spiderdaz commented 3 years ago

@courville just to confirm ,i have tried the tests with both programs on my all variants of the wd mycloud devices and they are returning the same results the smb 2 tests bcast or dns will return the files nested in the folder structure correctly. the smb tests seem to pick up the top layer folders but none of the lower folder/file structure i dont know if the smb 1 problem is from my win 10 pc or the devices themselves,but is presumably not the issue you are chasing anyway. i did notice with smb 1 tests ; ipc$ exists but not accessible but with smd 2 tests ;ipc$ does not exist dont know if it means anything to you??