View Issue Details

IDProjectCategoryView StatusLast Update
0006199Talerexchangepublic2021-09-02 16:14
Reporterfefe Assigned ToChristian Grothoff Resolution deadline
ImplementerReviewer 
Release signed byDeployed by 
VerifierCommunicator 
Data protection authority notification requiredNo  
CSIRT notification requiredNo  
Estimated effort (hours)Actual effort (hours)0 
Fast-trackNo
Work packagenone
PrioritynormalSeveritytrivialReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.7.0 
Target Version0.8Fixed in Version0.8 
Summary0006199: loading the terms of service files into memory seems wasteful
DescriptionThis is about load_terms in exchange/src/mhd/mhd_legal.c.

Basically, the function loads a bunch of files into memory. Does a stat to find the length, then mallocs that much (without bounds!) and reads the file contents into that buffer.

These files will usually not be very large so it probably does not matter much. However, I would suggest using mmap instead of malloc+read. In both cases you get a pointer, but it puts less strain on the OS and the memory usage of your application.
TagsNo tags attached.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Christian Grothoff

2020-04-22 13:07

manager   ~0015730

If we REALLY cared about performance, we could even use MHD's sendfile() here, but then we'd burn an fd per ToS/PP-file.

Christian Grothoff

2020-04-22 20:48

manager   ~0015738

Moreover, if we REALLY care about performance, we should probably keep the compressed response in RAM instead of re-doing the compression per request. That'll be worse for RAM, but almost certainly beats re-doing gzip all the time.

Christian Grothoff

2020-07-21 19:33

manager   ~0016494

Implemented in d9e871b5..6d52922c

Christian Grothoff

2021-09-02 16:14

manager   ~0018248

Fix committed to master branch.

Issue History

Date ModifiedUsernameFieldChange
2020-04-22 11:30fefeNew Issue
2020-04-22 11:30fefeStatusnew => assigned
2020-04-22 11:30fefeAssigned To => Christian Grothoff
2020-04-22 13:07Christian GrothoffNote Added: 0015730
2020-04-22 20:48Christian GrothoffNote Added: 0015738
2020-04-22 21:14Christian GrothoffAssigned ToChristian Grothoff =>
2020-04-22 21:14Christian GrothoffStatusassigned => implementing
2020-04-22 21:14Christian GrothoffTarget Version => 0.9
2020-07-16 13:17Christian GrothoffAssigned To => Christian Grothoff
2020-07-16 13:17Christian GrothoffStatusimplementing => assigned
2020-07-21 19:33Christian GrothoffNote Added: 0016494
2020-07-21 19:33Christian GrothoffStatusassigned => informing
2020-07-21 19:33Christian GrothoffResolutionopen => fixed
2020-07-21 19:33Christian GrothoffFixed in Version => 0.8
2020-07-21 19:33Christian GrothoffTarget Version0.9 => 0.8
2021-08-24 14:23Christian GrothoffStatusinforming => closed
2021-09-02 16:13Christian Grothoff
2021-09-02 16:14Christian GrothoffNote Added: 0018248