src-d / gitbase

SQL interface to git repositories, written in Go. https://docs.sourced.tech/gitbase
Apache License 2.0
2.07k stars 123 forks source link

Problem executing loc UDF #982

Closed alexpdp7 closed 5 years ago

alexpdp7 commented 5 years ago

Running on the following repo:

https://github.com/dotnet-architecture/eShopOnUWP

, apparently:

$ docker-compose exec gitbase mysql -u root gitbase
...
Server version: 5.5.10-Vitess 
MySQL [gitbase]> select * from files as f where blob_hash = '24a8e87939aa53cdd833f6be7610cb4972e063ad' and repository_id = 'github.com/dotnet-architecture/eShopOnUWP' and tree_hash = '7f8975e61c440a66a33eb8702655e393efcaaac3';
+-------------------------------------------+----------------+------------------------------------------+------------------------------------------+-----------------+--------------------------------------------+-----------+
| repository_id                             | file_path      | blob_hash                                | tree_hash                                | tree_entry_mode | blob_content                               | blob_size |
+-------------------------------------------+----------------+------------------------------------------+------------------------------------------+-----------------+--------------------------------------------+-----------+
| github.com/dotnet-architecture/eShopOnUWP | .gitattributes | 24a8e87939aa53cdd833f6be7610cb4972e063ad | 7f8975e61c440a66a33eb8702655e393efcaaac3 | 0100644         | *.png filter=lfs diff=lfs merge=lfs -text
 |        42 |
+-------------------------------------------+----------------+------------------------------------------+------------------------------------------+-----------------+--------------------------------------------+-----------+
1 row in set (0.06 sec)

MySQL [gitbase]> select loc(f.file_path, f.blob_content) as loc_value from files as f where blob_hash = '24a8e87939aa53cdd833f6be7610cb4972e063ad' and repository_id = 'github.com/dotnet-architecture/eShopOnUWP' and tree_hash = '7f8975e61c440a66a33eb8702655e393efcaaac3'
    -> ;
ERROR 2013 (HY000): Lost connection to MySQL server during query
gitbase_1                | time="2019-10-22T18:37:41Z" level=info msg="audit trail" action=authorization address="127.0.0.1:52402" connection_id=1 permission=read pid=3 query="select loc(f.file_path, f.blob_content) as loc_value from files as f where blob_hash = '24a8e87939aa53cdd833f6be7610cb4972e063ad' and repository_id = 'github.com/dotnet-architecture/eShopOnUWP' and tree_hash = '7f8975e61c440a66a33eb8702655e393efcaaac3'" success=true system=audit user=root
gitbase_1                | panic: runtime error: invalid memory address or nil pointer dereference
gitbase_1                | [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xefc187]
gitbase_1                | 
gitbase_1                | goroutine 48 [running]:
gitbase_1                | github.com/src-d/gitbase/internal/function.(*LOC).getLanguage(0xc000c29a80, 0xc0010154a0, 0xe, 0xc00152a000, 0x2a, 0x600, 0xe, 0xc00152a000, 0x2a, 0x600)
gitbase_1                |  /go/src/github.com/src-d/gitbase/internal/function/loc.go:148 +0x77
gitbase_1                | github.com/src-d/gitbase/internal/function.(*LOC).Eval(0xc000c29a80, 0xc0001714a0, 0xc00031a7e0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0)
gitbase_1                |  /go/src/github.com/src-d/gitbase/internal/function/loc.go:78 +0x217
gitbase_1                | github.com/src-d/go-mysql-server/sql/expression.(*Alias).Eval(0xc000c29aa0, 0xc0001701e0, 0xc00031a7e0, 0x7, 0x7, 0xc000d77d60, 0x82f72d, 0xc000170460, 0xbf63f0fd569a4afe)
gitbase_1                |  /go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190821121850-0e0249cf7bc0/sql/expression/alias.go:27 +0x5f
gitbase_1                | github.com/src-d/go-mysql-server/sql/plan.filterRow(0xc0001701e0, 0xc000305f30, 0x1, 0x1, 0xc00031a7e0, 0x7, 0x7, 0xc000d77dd0, 0x48b2e6, 0x5daf4c75, ...)
gitbase_1                |  /go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190821121850-0e0249cf7bc0/sql/plan/project.go:131 +0xd4
gitbase_1                | github.com/src-d/go-mysql-server/sql/plan.(*iter).Next(0xc000cf6080, 0x477d0bfab, 0x254b760, 0x1733b40, 0x0, 0x25726a0)
gitbase_1                |  /go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190821121850-0e0249cf7bc0/sql/plan/project.go:117 +0xc3
gitbase_1                | github.com/src-d/go-mysql-server/sql.(*spanIter).Next(0xc000170be0, 0xc000d77eac, 0x3, 0x2, 0xc00014a400, 0x0)
gitbase_1                |  /go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190821121850-0e0249cf7bc0/sql/session.go:361 +0x5d
gitbase_1                | github.com/src-d/go-mysql-server/sql/plan.(*exchangeRowIter).iterPartition(0xc00014a420, 0x17304a0, 0xc000eec330)
gitbase_1                |  /go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190821121850-0e0249cf7bc0/sql/plan/exchange.go:234 +0x255
gitbase_1                | github.com/src-d/go-mysql-server/sql/plan.(*exchangeRowIter).start.func1(0xc00014a420, 0xc000484040, 0x17304a0, 0xc000eec330)
gitbase_1                |  /go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190821121850-0e0249cf7bc0/sql/plan/exchange.go:159 +0x3f
gitbase_1                | created by github.com/src-d/go-mysql-server/sql/plan.(*exchangeRowIter).start
gitbase_1                |  /go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190821121850-0e0249cf7bc0/sql/plan/exchange.go:158 +0x10d