That worked.
In my case I created a username and password in BeGroups first before I created it on https://eternal-september.org/ . Thats what caused the issue. Maybe there should be a check or a failsafe if that occurs.
That worked.
In my case I created a username and password in BeGroups first before I created it on https://eternal-september.org/ . Thats what caused the issue. Maybe there should be a check or a failsafe if that occurs.
Yeah,account handling needs to be improved for sure.
The original code (which dates back to BeOS) didn’t even have any check for changes here to invalidate the cached groups list.
It took me very long to figure out why I only saw so few available newsgroups,so I knew I had to at least hack in a quick&dirty cache invalidation here to avoid confusing everyone.
Sorry that it didn’t work for you.
Working fine on beta5. I created the hpkg on a nightly build (x86_64), and found that the package works fine on beta5 with no errors when installed.
One thing I noticed that people might need to know. If you use a modified host file for ad blocking, you will have connections errors that will not allow you to get the list of newsgroups.
Normally I use Steven Black’s host files and I was unable to use his host file, and use BeGroups. Using the default host file, I’ve had no issues.
Thanks for letting me know,that should absolutely not be the case and I’ll try to fix this as soon as possible.
Adblocking is essential to protect your privacy online and BeGroups shouldn’t conflict with that.
The only reason that could possibly be the case is if the server BeGroups is connecting to is on that list - that I can see, anyway.
@dasouth: What server did you try to connect to?
I’ve tried two of the servers with the same results. The servers were eternal-september and Usenet and both had the same issue with modified host file.
Sorry for asking the obvious things, but have you checked if the news servers that you configured in BeGroups are in the hosts file that you use? That would be the obvious reason for it not to work.
Does a ping command to the news server work?
Which one of Steven Blacks hosts files are you using exactly? I just looked at his Github repo and there are several of them.
I use the adware + malware host file
OK, did some more tests. This is getting interesting. I can confirm and replicate the problem.
I’m using Steven Black’s hosts file from the category Adware+Malware (https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts). The news server I have configured in BeGroups is reader80.eternal-september.org. If I use the hostsfile mentioned before, BeGroups can neither fetch new messages nor get an updated list of newsgroups. Sometimes this results in an error being displayed(“Connection refused”), sometimes the app just crashes. If I switch back to the default host file, everything works again. This behaviour seems to be consistent, I’ve tried it around 10 times.
So far so good. I’ve grepped the hosts file for the domain name (eternal-september.org), no entries.
I can ping the news server, and I can connect via telnet to it on port 119 (nntp) even when the Steven Black hosts file is in use.
I admit this lead me to scratch my head for a bit. At first I thought that the news server URL is maybe redirected to another server that is contained in the hosts file (unlikely but possible). But why does the telnet command work while BeGroups is unable to connect?
Another question that came up for me was: In which order are names resolved in Haiku? Is there something along the lines of nsswitch.conf on Linux?
Indeed.
Adding some traces I see two connections, one of them returning the data for a different name, one in the list, a different one each time, but not very far from each other.
Those two connections are tried “at the same time”, and gethostbyname, called for each of them, is not reentrant. Using gethostbyname_r would solve the issue, but it is not public. A BLocker (or whatever other appropriate sync primitive) works beatifully. Just make gethostbyname and the next line (until you don’t use the returned structure anymore) non-parallel.
Unrelated, you want to go through the compilation warnings. There are a few about delete that shouold be delete[] and using it on abstract classes with no virtual destructor. I also saw a ‘you must Lock a looper before calling Quit()’ for the Server Dlog.
Does that mean that a different server, other than the configured one, is contacted. If yes, which one?
Is that relevant to the problem of the app not working when the adblocking hosts file is in place?
No, I really don’t
I’m not the author of this app, I’ll leave it to him to address these issues.
But thank you very much for pointing this out.
It’s the reason that it doesn’t work. The two functions running at the same time are modifying the same structures, so when one finishes it contains whatever the other one is up to. That is, if they don’t trip each other and one accesses memory the other one has deleted. Which answers the other question: it contacts whatever is there when the data is used. If it’s from that file it will probably point nowhere, but it’s a bad result anyway.
Well, yeah. That was not a you you. ![]()
You should probably use getaddrinfo instead of gethostbyname anyways. It gives you more control about what you query, and for example supports IPv6 better (using IPv6 addresses only if available on the local machine for example).
Thank you very much for the detailed analysis @madmax.
I planned to look into this today,but it would have taken me hours or days to figure out that this is the reason,if I found it at all.
Now I know what to do and hope I can get it solved quickly.
I’ll also look at the other compiler warnings.
I already fixed some of the “You must Lock a looper before calling Quit()” type,but missed the one in the Server Dlog as you see that window only once usually.
That should never happen and I don’t see any hint in the code that it does.
gethostbyname() is used only at one place in the code and takes the host directly from the preferences.
What it does is connect to the same server multiple times,so you can do multiple actions in parallel,and I guess that’s the cause of problems here.
I’ll have a look at this function and the difference it makes.
All I need is “I give you a domain, give me a IP address”,so I’ll go with the simpler solution in any case.
The simplest should be BNetworkAddress and/or BNetworkAddressResolver (from haiku.git) but these are not documented yet ![]()
I get that. But how does that explain that the app consistently works with the default hosts file and consistently fails with the adblocking one? That’s still a mystery to me.
I tried with BNetAddress which is documented in the good old Be Book: The Be Book - Classes And Methods - The Network Kit
Now that makes the code a bit simpler and the application keeps working with the default hosts file,but it still throws errors when using the hosts file generated by hblock.
I captured network traffic using Wireshark and see that it did connect and authenticate to the server perfectly fine in one thread,but the other task complains that it couldn’t open a connection.
Does BNetAddress also have issues with concurrent requests like gethostbyname or is the problem somewhere else?
Edit: Problem solved ![]()
BNetAddress isn’t thread-safe (uses gethostbyname internally),but BNetworkAddress is and they are similar enough that switching was easy.
The mysteries of unsynchronized parallel code. The adblocking file is much much larger than the default one, so threads have a much larger probability of clashing. In my tests, the faulty result had data from the 62000-65000th line.