devstats-example icon indicating copy to clipboard operation
devstats-example copied to clipboard

Hitting "invalid file data returned for repo" after running deploy.sh

Open Reshrahim opened this issue 2 years ago • 4 comments

I am currently setting up the devstats dashboard for Radius

Followed the instructions in the readme to set it up

Hitting the below error after running deploy.sh

2023-11-10 11:33:47 radius/get_repos: Running on database: radius
2023-11-10 11:33:48 radius/get_repos: Database 'radius' processed took 37.874541ms, new commits: 738
2023-11-10 11:33:48 radius/get_repos: Got 1 DBs new commits list: took 46.9895ms
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/docs 185e5039da6d3548f125da845616ebc018950184
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/design-notes 400041d431b6715104be4e80af736786f2c3653a
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/radius 9985ae2b2803542c805277f1ca534f7eed27fbac
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/docs 5eb3409b97602b155f6796aa64a8d0d0607050e1
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/docs c891268e0cbf7222e24337add95a1a111ba0302a
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/docs f42ee786725804e8b1c56a2012282736bd99076e
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/radius 744efecf3998cf897f5b224c54941ac424bce17d
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/docs d9be7b5d548dc23189f867e9e719a20880022386
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/docs 588d1ab0f04dafc06d2f4e5a0463c748b479b845
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/radius 85f0dc28d5caae230b23fbae208700e571e7dddf
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: Environment Override: map[GIT_TERMINAL_PROMPT:0]
2023-11-10 11:33:48 radius/get_repos: git_files.sh /Users/reshmaabdulrahim/devstats_repos/radius-project/radius 85f0dc28d5caae230b23fbae208700e571e7dddf ... 308.572541ms
2023-11-10 11:33:48 radius/get_repos: ErrorType: *errors.errorString, error: invalid fileData returned for repo: radius-project/radius, sha: 85f0dc28d5caae230b23fbae208700e571e7dddf: '��♀-1'
2023-11-10 11:33:48 radius/get_repos: Error(time=2023-11-10 11:33:48.324661 -0500 EST m=+0.374130459):
Error: 'invalid fileData returned for repo: radius-project/radius, sha: 85f0dc28d5caae230b23fbae208700e571e7dddf: '��♀-1''
Stacktrace:
goroutine 45 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x64
github.com/cncf/devstatscode.FatalOnError({0x104b3bb38, 0x140003941f0})
        /Users/reshmaabdulrahim/Documents/GitHub/cncf/devstatscode/error.go:58 +0x7c4
github.com/cncf/devstatscode.Fatalf({0x104a4080b?, 0x7?}, {0x1400032df08?, 0x6?, 0x0?})
        /Users/reshmaabdulrahim/Documents/GitHub/cncf/devstatscode/error.go:70 +0x28
main.getCommitFiles(0x0?, 0x14000143400, 0x0?, 0x0, {0x14000192288, 0x15}, {0x14000198270, 0x28})
        /Users/reshmaabdulrahim/Documents/GitHub/cncf/devstatscode/cmd/get_repos/get_repos.go:551 +0x82c
created by main.processCommits in goroutine 1
        /Users/reshmaabdulrahim/Documents/GitHub/cncf/devstatscode/cmd/get_repos/get_repos.go:690 +0x192c

Not sure if this is something related to my project.yaml which looks like below

---
projects:
  radius:
    order: 1
    name: Radius
    status: "-"
    command_line:
      - radius-project
    start_date: 2023-10-18T00:00:00Z
    join_date: null
    psql_db: radius
    main_repo: 'radius-project/radius'
    annotation_regexp: ''
    files_skip_pattern: ''
    # disabled: true

Reshrahim avatar Nov 10 '23 17:11 Reshrahim

I can take a look on Monday when I'm back from KubeCon, but you can also check that stack dump in code and see when that message is returned, in any case I will investiage next week.

lukaszgryglicki avatar Nov 10 '23 20:11 lukaszgryglicki

I've checked this exact repo and commit sha and it works OK for me, The error suggests that your system cannot parse using separator ♂♀ somehow, but I cannot replicate this. Can you open the cmd/get_repos/get_repos.go file and then go to 551 line:

    if len(fileDataAry) != 2 {
>>      lib.Fatalf("invalid fileData returned for repo: %s, sha: %s: '%s'", repo, sha, fileData)
    }

And change this to:

    if len(fileDataAry) != 2 {
      lib.Printf("invalid fileData returned for repo: %s, sha: %s: '%s'", repo, sha, fileData)
      continue
    }

Then compile get_repos again via make in the root directory and retry. I've spent some time debugging to the very lowest level and I can't find an issue other than suspecting that some UTF8 characters cannot be used as separators in your machine.

I'm adding a blocked label.

lukaszgryglicki avatar Nov 13 '23 09:11 lukaszgryglicki

Thanks for looking into this. I made the change as you suggested, and retried. It is now failing at a different place - should I manually create the trepo_groups table?

2023-11-13 19:02:52 radius/gha2db_sync: structure ... 83.741292ms
2023-11-13 19:02:52 radius/gha2db_sync: TS range: 2023-10-18 0 - 2023-11-13 19
2023-11-13 19:02:52 radius/gha2db_sync: tags
2023-11-13 19:02:53 radius/gha2db_sync: tags ... 346.784167ms
2023-11-13 19:02:53 radius/gha2db_sync: columns
2023-11-13 19:03:53 radius/gha2db_sync: select "repo_group_name" from "trepo_groups"
Compiled 2023-11-13_11:51:47PM, commit: 989cef61420a093e10d0a251408b6a4986133996 on Darwin_Reshmas-MacBook-Pro.local_23.1.0_Darwin_Kernel_Version_23.1.0:_Mon_Oct__9_21:27:24_PDT_2023;_root:xnu-10002.41.9~6/RELEASE_ARM64_T6000_arm64 using go_version_go1.21.4_darwin/arm64
2023-11-13 19:02:53 radius/columns: PqError: code=42P01, name=undefined_table, detail=
2023-11-13 19:02:53 radius/columns: Error(time=2023-11-13 19:02:53.214088 -0500 EST m=+0.013734710):
Error: 'pq: relation "trepo_groups" does not exist'
Stacktrace:
goroutine 7 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x64
github.com/cncf/devstatscode.FatalOnError({0x100773de8, 0x140000bc000})
        /Users/reshmaabdulrahim/Documents/GitHub/cncf/devstatscode/error.go:58 +0x7c4
github.com/cncf/devstatscode.QuerySQLWithEr

I'll continue to debug this tomorrow..meanwhile if you have any pointers to debug this let me know

Reshrahim avatar Nov 14 '23 00:11 Reshrahim

I think you didn't define repository groups for your project, it's really hard to say what exactly happens in your environment, I would have to replicate the entire environment and setup files, and try to run locally myself. But if tags run and there is no trepo_groups table - this means that you didn't define any repo groups in your metric/project-name/tags.yaml.

It seems like you refer to some column expression in columns.yaml that uses repo groups tag, but there are no repo groups in tags.yaml - investigate your metrics.yaml, columns.yaml and tags.yaml files in metrics/project-name directory - if any is missing then it falls back to metrics/shared/ - maybe you created one but didn't create another so they don't co-operate correctly - I would need to see your full setup.

lukaszgryglicki avatar Nov 14 '23 05:11 lukaszgryglicki