Michael Tokarev
2024-Oct-31 11:37 UTC
[Samba] Kerberos ticket renew causes a brief network interruption
Hi! I haven't seen this thread until now. But it looks like this is exactly the case with our network, which I mentioned in a "strange" bug/issue report a while back (sorry can't immediately find a reference to my own post). The prob in my case was that occasionally, the mapped network drives (mapped to samba server in a samba ad) disconnects, and windows shows red X near the drive icon in explorer. Also, Far Manager app (a Norton Commander clone), if it is left with a network path open on its panel, which is supposed to refresh contents on changes, shows error instead, saying the network path is unavaliable. At the same time, just clicking on the drive icon in Explorer (or acknowleging error message in Far Manager) is enough for the connection to be restored. It looks like the root cause of this my issue is the same as in this thread - brief network disconnect on a kerberos ticket renew, which isn't happen often to be easily reproducible, but not rare enough to be non-annoying at times. Now, for fun, a couple weeks ago I had some time and decided to work on that our issue, - to get the network traces asked by Jeremy at the time of my initial report (since it doesn't happen often, I had to run packet capture for quite some time). And it turned out that with current version of samba (I was using 4.20.5 at the time), I don't longer see these disconnects anymore. I had the packet capture running for 4 days in a row (restarting it to start new capture to save space), keeping the Far Manager window open in a usual user session, - to no avail. I think the last version where I had definitely seen that issue was 4.18 or 4.19 (can't say for sure anymore). And it looks like current samba does not have this issue anymore. Is there a way to trigger ticket renew from windows somehow? Thanks, /mjt
Hans van Leeuwen
2024-Oct-31 14:26 UTC
[Samba] Kerberos ticket renew causes a brief network interruption
Hi Micheal Tokarev, In my case I can reproduce the network interruption quit easy and consistent with a small dedicated written C-program. This C-program opens every 3 seconds a map on the share en read the map contents. After the +/- 9 hour of the Kerberos renewal interval time the problem occurs. I compiled this C-program with gcc. I also don't see a red cross in the file-explorer. I expect that the network interruption is to short. My latest Samba version is 4.19.5. I called my C-program hotfolderscan . I start this tools with "hostfolderdscan M:\hotfolder C:\temp\hotfolderscan.log" (M: is a share on the Samba server.) Below the C source of this hotfolderscan tool. Best regards, Hans van Leeuwen #include <stdio.h> #include <strings.h> #include <errno.h> #include <dirent.h> #include <unistd.h> #include <time.h> void main(int c, char **argv) { int avail, lost_connection, closedir(); char *strerror(); DIR *pdir; struct dirent *pdent, *readdir(); FILE *fptr; void log_print_date_time(); avail = 0; lost_connection = 0; fptr = fopen(argv[2], "w"); while (1) { if (avail == 0) { pdir = opendir(argv[1]); if (pdir != NULL) { avail = 1; } } if (avail == 1) { pdent = readdir(pdir); /* current directory . */ if (pdent != NULL) { if (lost_connection == 1) { lost_connection = 0; log_print_date_time(fptr); fprintf(fptr, "Share available again\n "); fflush(fptr); } pdent = readdir(pdir); /* One directory higher .. */ if (pdent != NULL) { pdent = readdir(pdir); /* first file in current direcctory */ } else { if (lost_connection == 0) { avail = 0; lost_connection = 1; log_print_date_time(fptr); fprintf(fptr, "Error %d %s\n ", errno, strerror(errno)); fflush(fptr); } } } else { if (lost_connection == 0) { avail = 0; lost_connection = 1; log_print_date_time(fptr); fprintf(fptr, "Error %d %s\n ", errno, strerror(errno)); fflush(fptr); } } } sleep(3); rewinddir(pdir); } closedir(pdir); fclose(fptr); } void log_print_date_time(FILE *fptr) { time_t ctime; struct tm tim; ctime = time(NULL); tim = *localtime(&ctime); fprintf(fptr, "%d-%02d-%02d %02d:%02d:%02d ", tim.tm_year + 1900, tim.tm_mon + 1, tim.tm_mday, tim.tm_hour, tim.tm_min, tim.tm_sec); } -----Original Message----- From: Michael Tokarev <mjt at tls.msk.ru> Sent: Thursday, October 31, 2024 12:37 PM To: Hans van Leeuwen <HansvanLeeuwen at mailstreet.nl>; samba at lists.samba.org; Ralph Boehme <slow at samba.org> Subject: Re: [Samba] Kerberos ticket renew causes a brief network interruption [You don't often get email from mjt at tls.msk.ru. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] LET OP: Deze e-mail is afkomstig van buiten de organisatie. Klik niet op links of open geen bijlagen tenzij je zeker weet dat je de afzender herkent. Hi! I haven't seen this thread until now. But it looks like this is exactly the case with our network, which I mentioned in a "strange" bug/issue report a while back (sorry can't immediately find a reference to my own post). The prob in my case was that occasionally, the mapped network drives (mapped to samba server in a samba ad) disconnects, and windows shows red X near the drive icon in explorer. Also, Far Manager app (a Norton Commander clone), if it is left with a network path open on its panel, which is supposed to refresh contents on changes, shows error instead, saying the network path is unavaliable. At the same time, just clicking on the drive icon in Explorer (or acknowleging error message in Far Manager) is enough for the connection to be restored. It looks like the root cause of this my issue is the same as in this thread - brief network disconnect on a kerberos ticket renew, which isn't happen often to be easily reproducible, but not rare enough to be non-annoying at times. Now, for fun, a couple weeks ago I had some time and decided to work on that our issue, - to get the network traces asked by Jeremy at the time of my initial report (since it doesn't happen often, I had to run packet capture for quite some time). And it turned out that with current version of samba (I was using 4.20.5 at the time), I don't longer see these disconnects anymore. I had the packet capture running for 4 days in a row (restarting it to start new capture to save space), keeping the Far Manager window open in a usual user session, - to no avail. I think the last version where I had definitely seen that issue was 4.18 or 4.19 (can't say for sure anymore). And it looks like current samba does not have this issue anymore. Is there a way to trigger ticket renew from windows somehow? Thanks, /mjt