OK could not wait for weekend and did all tests today.
Debian with Samba 4.15.9 compiled from source (the same version TrueNAS is using) works perfectly - so it is not problem with this particular Samba version.
Maybe problem is with FreeBSD? I realised that their pkg Samba (the latest available is 4.13.17) does not have Spotlight enabled so compiled from ports with Spotlight ON. All works perfectly - I can search files by their content. It is not FreeBSD issue.
These results more and more point into problem with TrueNAS Samba - they use their own fork.
Errors sequence we see in TrueNAS smb.log when ES response is received starts with:
Code:
[2022/09/29 15:56:50.745574, 0, pid=93402, effective(1000, 1000), real(0, 0)] ../../libcli/http/http.c:199(http_parse_response_line)
http_parse_response_line: Error parsing header
and this is where it gets real interesting. FreeBSD samba port patches exactly this file - http.c - and exactly in place where this error is thrown:
cgit.freebsd.org
in vanilla Samba:
Code:
n = sscanf(line, "%m[^:]: %m[^\r\n]\r\n", &key, &value);
if (n != 2) {
DEBUG(0, ("%s: Error parsing header '%s'\n", __func__, line));
status = HTTP_DATA_CORRUPTED;
goto error;
}
but in FreeBSD:
Code:
#ifdef FREEBSD
int s0, s1, s2, s3; s0 = s1 = s2 = s3 = 0;
n = sscanf(line, "%n%*[^/]%n/%c.%c %d %n%*[^\r\n]%n\r\n",
&s0, &s1, &major, &minor, &code, &s2, &s3);
if(n == 3) {
protocol = calloc(sizeof(char), s1-s0+1);
msg = calloc(sizeof(char), s3-s2+1);
n = sscanf(line, "%[^/]/%c.%c %d %[^\r\n]\r\n",
protocol, &major, &minor, &code, msg);
}
#else
n = sscanf(line, "%m[^/]/%c.%c %d %m[^\r\n]\r\n",
&protocol, &major, &minor, &code, &msg);
#endif
if (n != 2) {
DEBUG(0, ("%s: Error parsing header '%s'\n", __func__, line));
status = HTTP_DATA_CORRUPTED;
goto error;
}
Could not find out TrueNAS Core Samba source code (I only started using TrueNAS and FreeBSD last week and still learning) to see what is there but I think that now we have enough info to create meaningful bug report. For this your traces would be extremely helpful - unfortunately I am not sure how to get them.
Hopefully some TrueNAS dev can look into it and figure out what is wrong with their Samba 4.15.9.
ES search over Samba really makes difference - works very well. Of course then it will be yet another story how to optimise it etc. Already can see that it needs good amount of RAM - I tried with 30k files and used like 5GB.