5 seconds to update link info?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

5 seconds to update link info?

Andrey Repin
Greetings, All!

_a=fileA;
_b=fileB;
[ ! -f "$_a" ] && touch "$_a";
[ ! -f "$_b" ] && ln "$_a" "$_b";
for i in $(seq 1 10);
do sleep 1;
[ "$_a" -ef "$_b" ] && { echo Timed in $i; break;}; done;
rm "$_a" "$_b"

When executed this oneliner over Samba 4.3 network share, it takes 5 seconds
to match the newly created hardlink.
I'm wondering if this is Cygwin, Samba or Windows networking issue?


--
With best regards,
Andrey Repin
Saturday, May 20, 2017 00:31:35

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: 5 seconds to update link info?

Richard H Lee-2
On 19/05/2017 22:37, Andrey Repin wrote:
> When executed this oneliner over Samba 4.3 network share, it takes 5
> seconds to match the newly created hardlink. I'm wondering if this is
> Cygwin, Samba or Windows networking issue?

I think it's something to do with windows name resolution.

Try running:
ls //

You should see a similar delay.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: 5 seconds to update link info?

Richard H Lee-2
On 19/05/2017 23:01, Richard H Lee wrote:

> On 19/05/2017 22:37, Andrey Repin wrote:
>> When executed this oneliner over Samba 4.3 network share, it takes 5
>> seconds to match the newly created hardlink. I'm wondering if this is
>> Cygwin, Samba or Windows networking issue?
>
> I think it's something to do with windows name resolution.
>
> Try running:
> ls //
>
> You should see a similar delay.

I forgot to mention that you can get rid of this delay by disabling
NetBIOS on your active network connection(s). I don't think this should
interfere with the operation of Samba.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: 5 seconds to update link info?

Andrey Repin
Greetings, Richard H Lee!

> On 19/05/2017 23:01, Richard H Lee wrote:
>> On 19/05/2017 22:37, Andrey Repin wrote:
>>> When executed this oneliner over Samba 4.3 network share, it takes 5
>>> seconds to match the newly created hardlink. I'm wondering if this is
>>> Cygwin, Samba or Windows networking issue?
>>
>> I think it's something to do with windows name resolution.
>>
>> Try running:
>> ls //
>>
>> You should see a similar delay.

> I forgot to mention that you can get rid of this delay by disabling
> NetBIOS on your active network connection(s). I don't think this should
> interfere with the operation of Samba.

I've tried to disable NetBIOS over TCP/IP on client for all adapters active,
but nothing has changed.


--
With best regards,
Andrey Repin
Saturday, May 20, 2017 03:35:13

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: 5 seconds to update link info?

L A Walsh
In reply to this post by Andrey Repin
Andrey Repin wrote:

> Greetings, All!
>
> _a=fileA;
> _b=fileB;
> [ ! -f "$_a" ] && touch "$_a";
> [ ! -f "$_b" ] && ln "$_a" "$_b";
> for i in $(seq 1 10);
> do sleep 1;
> [ "$_a" -ef "$_b" ] && { echo Timed in $i; break;}; done;
> rm "$_a" "$_b"
>
> When executed this oneliner over Samba 4.3 network share,
----
    What oneliner?



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: 5 seconds to update link info?

Richard H Lee-2
In reply to this post by Andrey Repin
On 20/05/2017 01:39, Andrey Repin wrote:
> I've tried to disable NetBIOS over TCP/IP on client for all adapters
> active, but nothing has changed.

You could always try using Wireshark to get more insight as to what is
causing the delay.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: 5 seconds to update link info? (cause found)

L A Walsh
In reply to this post by Andrey Repin
Andrey Repin wrote:
> When executed this oneliner over Samba 4.3 network share, it takes 5 seconds
> to match the newly created hardlink.
> I'm wondering if this is Cygwin, Samba or Windows networking issue?
>  

====
BTW -- found the cause of this:
   Under:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanWorkstation\Parameters


There are 3 values to control cache lifetime.

FileInfoCacheLifetime (default 10 seconds)
FileNotFoundCacheLifetime (default 5 seconds)
DirectoryCacheLifetime (default 10 seconds)

The FileNotFoundCacheLifetime looks to be the culprit -- since
when I traced the ethernet traffic with wireshark, I would see
multiple responses of 'notfound' before it finally showed up.

I reset my 5-second value to 3, and your script passed over
its value in 3 seconds after that...

You might have to reboot your machine to ensure the value gets
propegated to the LANmanworkstation client.


There are other ways, but none that reliable.






--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: 5 seconds to update link info? (cause found)

Andrey Repin
Greetings, L A Walsh!

> Andrey Repin wrote:
>> When executed this oneliner over Samba 4.3 network share, it takes 5 seconds
>> to match the newly created hardlink.
>> I'm wondering if this is Cygwin, Samba or Windows networking issue?
>>  

> ====
> BTW -- found the cause of this:
>    Under:
> HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanWorkstation\Parameters


> There are 3 values to control cache lifetime.

> FileInfoCacheLifetime (default 10 seconds)
> FileNotFoundCacheLifetime (default 5 seconds)
> DirectoryCacheLifetime (default 10 seconds)

> The FileNotFoundCacheLifetime looks to be the culprit -- since
> when I traced the ethernet traffic with wireshark, I would see
> multiple responses of 'notfound' before it finally showed up.

> I reset my 5-second value to 3, and your script passed over
> its value in 3 seconds after that...

> You might have to reboot your machine to ensure the value gets
> propegated to the LANmanworkstation client.


> There are other ways, but none that reliable.

Thank you for this discovery. In the end, I've settled on a little wrapper.

waitlink() {
(
  set -e
  ln "$1" "$2"
  for i in . . . . . . . . . .; do
    [ "$1" -ef "$2" ] && break
    sleep 1
  done
)
}

since the execution time of the script is not mission-critical, I decided to
not alter the system settings.


--
With best regards,
Andrey Repin
Monday, May 29, 2017 22:23:30

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple