View Issue Details

IDProjectCategoryView StatusLast Update
0003803GNUnetNSE servicepublic2018-06-07 00:24
ReporterlynX Assigned ToChristian Grothoff  
PriorityhighSeveritytweakReproducibilityalways
Status closedResolutionno change required 
Platformx86OSlinuxOS Versionseveral
Product Version0.10.1 
Target Version0.11.0pre66Fixed in Version0.11.0pre66 
Summary0003803: gnunet-service-nse goes CPU hungry on default installation
DescriptionI have installed GNUnet on two machines, one has connectivity to the backbone, the other is isolated. In both cases the gnunet-service-nse process has gone through the roof (~70% CPU usage).

The only possibly unusual thing I was to start gnunet like an average user would:

mkdir /home/gnunet
chown gnunet:gnunet /home/gnunet
su - gnunet
gnunet-arm -s

[ignore some error message about missing .gnunet directory]

So all I did was to expect GNUnet to have a sane default configuration if I don't make a custom .gnunet directory.
TagsNo tags attached.

Activities

Bart Polot

2015-05-29 13:57

reporter   ~0009155

This is expected. NSE is calculating the proof of work to participate in the network. I guess we could modify the pause between PoW rounds to lower the CPU usage, but that would of course cause the calculation to take longer in Wall-Clock time.

Or maybe just warn the user?

I guess this could be a "usability bug"?

Bart Polot

2015-05-29 14:00

reporter   ~0009156

Last edited: 2015-05-29 14:00

Note we use 22 bits which is scaled to take 2h on a desktop machine, after this time NSE should take exactly 0% cpu.

Christian Grothoff

2015-05-29 14:05

manager   ~0009158

Well, the issue is that with a 'modern' system, the delay is set for NSE to go to like 30% CPU usage on one core. But with older systems the same delay can still mean close to 100% CPU, just like the 2h can turn into weeks if you just have a sufficiently ancient CPU.

We do have this in the FAQ already, so I'm not sure there is much to be done.

lynX

2015-05-29 14:17

reporter   ~0009162

I killed the process earlier. Does it mean my participation in GNUnet is doomed?

Other usability issue: The FAQ is not where the user manual is.

The FAQ sounds as if the proof-of-work is only to get the network size estimate right. Your average Joe User will not give a damn about that. Is it really only
for that purpose or is the proof-of-work used as sybil attack protection for all uses of the DHT, therefore absolutely essential? In that case the FAQ should make it clear.

Christian Grothoff

2015-05-29 14:26

manager   ~0009164

I'm curious as to how you killed the process. GNUnet services are very hard to kill. Are you sure it didn't immediately get resurrected by ARM? ;-)

The PoW is essential only for the NSE and for the DHT to perform correctly at scale, your peer will participate normally even if it has not been completed.

Bart Polot

2015-05-29 14:29

reporter   ~0009165

Absolutely essential? No.

Really nice to have? Yes.

It would be possible to make the cpu usage exactly what we want it to be, by timing the 'busy" period and then "sleeping" for the same amount of time (for 50%).


Also, wouldn't hurt to show a log message (WARNING level maybe?) with:
"This peer does not have an NSE proof-of-work. We are generating one and the CPU usage will rise. This is done only once per installation of GNUnet."

Christian Grothoff

2015-05-29 14:31

manager   ~0009166

Nobody will see the warning anyway, but I do like the idea of timing the busy period and making it like 25% CPU use, which most people won't get pissy about.

Bart Polot

2015-05-29 14:38

reporter   ~0009167

Well, another crazy idea: why not offload the PoW generation to a separate process and name it "gnunet-calm-down-im-suposed-to-use-25-perc-cpu-ill-be-done-in-a-minute"?

Christian Grothoff

2015-05-29 14:48

manager   ~0009171

No need for a separate process, you can just set argv[0] to "calm-done-read-GNUnet-FAQ" or whatever for the time we do the PoW calculation.

lynX

2015-05-29 14:56

reporter   ~0009173

I used killall. No running arms or legs have tried to restart it.

If the PoW isn't crucial, expect not only openwrt installations to come without (which is good) but potentially even distro packagers to sabotage the plan by preparing a GNUnet package that simply doesn't have that. You considered so many attack vectors in the design of GNUnet and didn't think of package maintainers?

"calm-done-read-GNUnet-FAQ" <- lol.

Bart Polot

2015-05-29 14:58

reporter   ~0009174

ACK

Bart Polot

2015-05-29 15:04

reporter   ~0009175

Not having that hurts GNUnet, specifically the DHT. The performance suffers quite a bit if *most* peers don't run it. I would absolutely not advise any maintainer to leave it out.

It's a first-run operation and if we make the load configurable we can let packagers set it a 5% if they are so afraid.

Even maybe post a beginner-task on Mantis to integrate nse with dbus and listen to power events to avoid running the PoW on battery.

Christian Grothoff

2015-05-29 15:05

manager   ~0009177

Ok. so let's go with timing the loop to auto-tune for 25% CPU usage (maybe only if the config option is not given, and remove the option by default?), and add the argv[0]-FAQ hint.

I'll look into why NSE didn't come back via autostart. Seems like another bug.

Bart Polot

2015-05-29 15:17

reporter   ~0009180

Last edited: 2015-05-29 15:19

This doesn't seem to work:

int main (int argc, char *argv[])
{
 argv[0]="FINDME";
 while(1){}
}

Overwriting argv[0] (argv[0][0] = 'F';) does work. However, is it safe? How big is the buffer? strlen(SERVICE_NAME) or is there a fixed value? Implementation dependant? SHould we asume strlen(NAME) as safe max?

lynX

2015-05-29 15:23

reporter   ~0009182

"KEEP-CALM-and-read-GNUnet-FAQ" :)

Christian Grothoff

2015-05-29 15:30

manager   ~0009184

Yes, AFAIk strlen(argv[0])+1 is the safe max. Fortunately, "gnunet-service-nse" is not that short, so typically the string will be long enough.

So

strncpy (argv[0], "KeepCalm-GNUnetFAQ", strlen (argv[0]));

should fit.

Christian Grothoff

2015-05-29 15:30

manager   ~0009185

Oh, and make sure to restore the name after PoW is done.

lynX

2015-05-29 21:40

reporter   ~0009192

Last edited: 2015-05-29 21:41

KeepCalmAndReadFAQ
gnunet-service-nse

that fits, too ;)

(although when using proportional fonts it doesn't look like it does!)


in the spirit of https://en.wikipedia.org/wiki/Keep_Calm_and_Carry_On

Christian Grothoff

2015-05-30 11:59

manager   ~0009193

Yes, I noticed that would fit and I'm aware of the meme. However, if we don't explicitly mention GNUnet, some users might not be able to figure out that this is a GNUnet process in the first place, so they won't know which FAQ to read.

lynX

2015-05-30 13:03

reporter   ~0009194

Oh, stupid me… you're right!

lynX

2015-06-01 06:53

reporter   ~0009215

One more FAQ… I have tried to fix the 'top' command to show me the full length of process names but to no avail… I can never see which gnunet service is running on top.

Is there a fix for top or can we dare to rename all gnunet-service-something processes into srv-something?

gnunet is the new internet stack anyway, it doesn't need to say so in 20% of the process names running on a computer…

Christian Grothoff

2015-06-01 09:56

manager   ~0009216

Use a wide terminal and press 'c' (to see full command-line).

lynX

2015-06-01 10:18

reporter   ~0009217

Last edited: 2015-06-01 10:19

Yeah, tried that already. Doesn't help since the installation path compiled into the binaries isn't /usr/bin .. it is /usr/depot/depot/linux-x86/gnunet-lux/lib/gnunet/libexec/... so the ending part of the process name again is not being displayed.

Would be cool if ./configure was able to distinguish installation paths from
runtime execution paths, because the files are actually available at the
runtime path which is /usr/depot/lib/gnunet/libexec/... There is no need for
them to be run from where they needed to be installed.

This is a separate problem from the distinction of architecture dependency
we discussed in that other bug report.

Christian Grothoff

2015-06-01 10:22

manager   ~0009218

I said to use a wide terminal ;-). Anyway, most users will see '/usr/lib/gnunet/libexec/gnunet-service-nse', which is a bit more likely to fit. Naturally, users can always put arbitrarily ridiculously long install paths, but that's their issue.

lynX

2015-06-01 10:55

reporter   ~0009220

configure --help doesn't mention DESTDIR. With that I was able to tweak a solution (a bit ugly, but nevermind). Still the path is inappropriately long:

/usr/local/lib/gnunet/libexec/gnunet-service-wtf

It is in fact uncommon practice to put /libexec under /lib (I only see KDE doing that, you don't want to imitate KDE habits), and the word gnunet is indeed redundant as the binary will not appear in command path and the execution path includes the word gnunet already. Hence the installation path should IMHO be:

/usr/local/libexec/gnunet/srv-wtf

With usability greetings from Berlin.

Christian Grothoff

2015-06-01 11:20

manager   ~0009221

Please take that up with FHS. KDE is doing the right thing here, according to my reading of the relevant documents:

https://lists.debian.org/debian-devel/2005/05/msg00405.html

http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLIBLIBRARIESFORPROGRAMMINGANDPA

http://www.linuxbase.org/betaspecs/fhs/fhs/ch04s07.html

The one that needs a usability improvement here is 'top': it needs a way to hide the path and just show the filename.

lynX

2015-06-01 12:28

reporter   ~0009224

Oh, gentoo disrespects FHS.

Ok, so on debian I see that "internal binaries" are in places like

/usr/lib/git-core/git-pull

so we could be using

/usr/local/lib/gnunet/bin/srv-wtf

to shorten the paths a bit…

And sure, a fix for top would be nice… but apparently nobody suffered hard enough in decades of topping.

Christian Grothoff

2017-02-26 02:12

manager   ~0011856

Clearly no change is required here, other than to 'top' which is a bit out-of-scope.

Issue History

Date Modified Username Field Change
2015-05-29 13:54 lynX New Issue
2015-05-29 13:54 lynX Status new => assigned
2015-05-29 13:54 lynX Assigned To => Bart Polot
2015-05-29 13:57 Bart Polot Note Added: 0009155
2015-05-29 13:59 Bart Polot Severity major => tweak
2015-05-29 14:00 Bart Polot Note Added: 0009156
2015-05-29 14:00 Bart Polot Note Edited: 0009156
2015-05-29 14:05 Christian Grothoff Note Added: 0009158
2015-05-29 14:17 lynX Note Added: 0009162
2015-05-29 14:26 Christian Grothoff Note Added: 0009164
2015-05-29 14:29 Bart Polot Note Added: 0009165
2015-05-29 14:31 Christian Grothoff Note Added: 0009166
2015-05-29 14:38 Bart Polot Note Added: 0009167
2015-05-29 14:48 Christian Grothoff Note Added: 0009171
2015-05-29 14:56 lynX Note Added: 0009173
2015-05-29 14:58 Bart Polot Note Added: 0009174
2015-05-29 14:58 Bart Polot Status assigned => acknowledged
2015-05-29 15:04 Bart Polot Note Added: 0009175
2015-05-29 15:05 Christian Grothoff Note Added: 0009177
2015-05-29 15:17 Bart Polot Note Added: 0009180
2015-05-29 15:19 Bart Polot Note Edited: 0009180
2015-05-29 15:23 lynX Note Added: 0009182
2015-05-29 15:30 Christian Grothoff Note Added: 0009184
2015-05-29 15:30 Christian Grothoff Note Added: 0009185
2015-05-29 21:40 lynX Note Added: 0009192
2015-05-29 21:41 lynX Note Edited: 0009192
2015-05-30 11:59 Christian Grothoff Note Added: 0009193
2015-05-30 13:03 lynX Note Added: 0009194
2015-06-01 06:53 lynX Note Added: 0009215
2015-06-01 07:24 Christian Grothoff View Status private => public
2015-06-01 09:56 Christian Grothoff Note Added: 0009216
2015-06-01 10:18 lynX Note Added: 0009217
2015-06-01 10:19 lynX Note Edited: 0009217
2015-06-01 10:22 Christian Grothoff Note Added: 0009218
2015-06-01 10:55 lynX Note Added: 0009220
2015-06-01 11:20 Christian Grothoff Note Added: 0009221
2015-06-01 12:28 lynX Note Added: 0009224
2017-02-26 02:12 Christian Grothoff Assigned To Bart Polot => Christian Grothoff
2017-02-26 02:12 Christian Grothoff Status acknowledged => resolved
2017-02-26 02:12 Christian Grothoff Resolution open => no change required
2017-02-26 02:12 Christian Grothoff Fixed in Version => 0.11.0pre66
2017-02-26 02:12 Christian Grothoff Note Added: 0011856
2017-02-26 02:12 Christian Grothoff Target Version => 0.11.0pre66
2018-06-07 00:24 Christian Grothoff Status resolved => closed