Issue
In the context of doing topic modeling experiments, @m09 and myself tried to use Gitbase to parse all blobs in tagged references of a given repository, in order to extract all identifiers, comments and literals. However, we have not been able to successfully use Gitbase to do so, and have had to switch to doing the parsing client side.
The reason for that is that, when querying Gitbase, we see the following behavior:
- An increase in memory usage.
- No decrease after time goes by.
- When all available memory is consumed, an increase in block I/O and a quasi stagnation of the memory consumed by Gitbase at 99.999 ... %, indicating heavy use of Swap memory.
- Server crash if the query goes on for too long past that point.
We still see the same behavior when retrieving only the blob contents from Gitbase, however the memory consumed is not an issue, as it is much less then when parsing UASTs. We have inferred that there was some caching going one, and after talking about the issue on the dev-processing channel, we tried to disable the caching - however it changed nothing. Javi told us that the caching we had disabled was for go-git cache, so it is probably something else.
What we don't understand is why we cannot get rid of the behavior, i.e. why once a blob has been parsed and returned client side it seemingly remains in memory.
Steps to reproduce
Launch gitbase and babelfish containers:
docker run -d --rm --name bblfshd --privileged -p 9432:9432 -m 4g bblfsh/bblfshd:v2.14.0-drivers
docker run -d --rm --name gitbase -p 3306:3306 --link bblfshd:bblfshd -e BBLFSH_ENDPOINT=bblfshd:9432 -m 2g -v /path/to/repos:/opt/repos srcd/gitbase:latest
With /path/to/repos pointing to a repository, for instance pytorch. Then, open two more terminals to monitor what's happening with docker stats, and run queries like this one for example for pytorch, using for example the mySQL client:
SELECT
cf.file_path,
cf.blob_hash,
LANGUAGE(cf.file_path) as lang,
uast_extract(uast(f.blob_content, LANGUAGE(cf.file_path), '//uast:String'), "Value")
FROM repositories r
NATURAL JOIN refs rf
NATURAL JOIN commit_files cf
NATURAL JOIN files f
WHERE r.repository_id = 'pytorch'
AND is_tag(rf.ref_name)
AND lang ='Python'
You should see the memory usage of the gitbase container increase sharply until hitting 2 GB, then a heavy increase in BLOCK I/O, and finally the container will crash.
Issue
In the context of doing topic modeling experiments, @m09 and myself tried to use Gitbase to parse all blobs in tagged references of a given repository, in order to extract all identifiers, comments and literals. However, we have not been able to successfully use Gitbase to do so, and have had to switch to doing the parsing client side.
The reason for that is that, when querying Gitbase, we see the following behavior:
We still see the same behavior when retrieving only the blob contents from Gitbase, however the memory consumed is not an issue, as it is much less then when parsing UASTs. We have inferred that there was some caching going one, and after talking about the issue on the dev-processing channel, we tried to disable the caching - however it changed nothing. Javi told us that the caching we had disabled was for
go-git cache, so it is probably something else.What we don't understand is why we cannot get rid of the behavior, i.e. why once a blob has been parsed and returned client side it seemingly remains in memory.
Steps to reproduce
Launch gitbase and babelfish containers:
With
/path/to/repospointing to a repository, for instancepytorch. Then, open two more terminals to monitor what's happening withdocker stats, and run queries like this one for example for pytorch, using for example the mySQL client:You should see the memory usage of the gitbase container increase sharply until hitting 2 GB, then a heavy increase in BLOCK I/O, and finally the container will crash.