Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.23.0-RC9 eventually hanging #646

Open
tocklime opened this issue Jan 23, 2025 · 4 comments
Open

0.23.0-RC9 eventually hanging #646

tocklime opened this issue Jan 23, 2025 · 4 comments
Assignees

Comments

@tocklime
Copy link

tocklime commented Jan 23, 2025

I have a folder on my NAS with about 50000 photo, video, and related files (I think maybe half of them are 'something that should be uploaded to immich'. There is at least one unzipped old google takeout in there, as well as dead picasa libraries and possibly even some iPhoto stuff.

I'm running 0.23.0-rc9 built with this nix flake (modified from the one in nixpkgs):

flake.nix
{
  inputs = {
    utils.url = "github:numtide/flake-utils";
  };
  outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
    let
      pkgs = nixpkgs.legacyPackages.${system};
      my_ig = pkgs.immich-go.overrideAttrs (prev: rec {
          inherit (prev) pname;
          version = "0.23.0-RC9";
          src = pkgs.fetchFromGitHub {
            owner = "simulot";
            repo = "immich-go";
            rev = "v${version}";
            hash = "sha256-MLd3paooyq7A5haO/vM66y/dqjJvbqlmXiEPhUTEmWM=";
            leaveDotGit = true;
            postFetch = ''
              cd "$out"
              git log -1 --pretty=%H > "COMMIT"
              git log -1 --pretty=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ' > "SOURCE_DATE"
              rm -rf ".git"
            '';
          };
          vendorHash = "sha256-P55dVLf8z+GmoWVGUBEjX+rSeRYr8OrAQYiecsmIcnI=";
          doCheck = false;
      });

    in
    {
      devShell = pkgs.mkShell {
        buildInputs = with pkgs; [
          my_ig
        ];
      };
    }
  );
}

When I run immich-go, it goes for quite a while, uploading about 10000 assets, but then it gets to a point where it does nothing. There have been no new log lines for over an hour (the most recent are about 'scanned image file'). There are no in progress jobs on the server. immich-go is still running (I assume it exits when it finishes).

When I press Ctrl-C, I get a lot (depending on the run, 100-700 ish) of ERR context canceled in the logs, and it exits.

I can rerun, and it spins through a lot of "Server has same quality", but eventually grinds to a halt after about 15000 files.

I'm getting occasional server errors (1 or 2 each run), but not sure if that's relevant.

Happy to provide logs and api traces, but would rather that wasn't public.

my immich-go command is

immich-go upload from-folder --manage-burst Stack --manage-heic-jpeg StackCoverHeic --manage-raw-jpeg StackCoverJPG --tag "{immich-go}/2025-01-22 20:55:02" /tank/Pictures --server $SERVER_URL -k $API_KEY --api-trace

(i started with -session-tag for the first run, but now using --tag to avoid API churn).

@tocklime
Copy link
Author

...now running with --ban-file ThatOneUnzippedGoogleTakeout/ and it seems to be getting further without stalling.

@simulot
Copy link
Owner

simulot commented Jan 23, 2025

Happy to provide logs and api traces, but would rather that wasn't public.

You can share them on my discord @simulot.

When I press Ctrl-C, I get a lot (depending on the run, 100-700 ish) of ERR context canceled in the logs, and it exits.

This is a clue... --from-folder tries to leverage goroutines (the go's multi-thread mechanism). Ctrl-C make all running routines to die with the context cancelled message. But, there is a limitation in the number of threads that should prevent this...

...now running with --ban-file ThatOneUnzippedGoogleTakeout/ and it seems to be getting further without stalling.

Is this folder symlinked or hadlinked to the /tank/Pictures? Maybe a ZFS special thing? A cycle?
If you have preserved the takeout content with all JSON, you may use import from-google-photos. It will import the photos with google features like albums and descriptions.

(i started with -session-tag for the first run, but now using --tag to avoid API churn).

What do you mean by to avoid API churn?
I'm working on a better tag assignment

@tocklime
Copy link
Author

Happy to provide logs and api traces, but would rather that wasn't public.

You can share them on my discord @simulot.

I'll get something zipped up in a minute.

When I press Ctrl-C, I get a lot (depending on the run, 100-700 ish) of ERR context canceled in the logs, and it exits.

This is a clue... --from-folder tries to leverage goroutines (the go's multi-thread mechanism). Ctrl-C make all running routines to die with the context cancelled message. But, there is a limitation in the number of threads that should prevent this...

...now running with --ban-file ThatOneUnzippedGoogleTakeout/ and it seems to be getting further without stalling.

Is this folder symlinked or hadlinked to the /tank/Pictures? Maybe a ZFS special thing? A cycle? If you have preserved the takeout content with all JSON, you may use import from-google-photos. It will import the photos with google features like albums and descriptions.

It is ZFS, but all in one dataset. No symlinks. The run with --ban-file completed, as did a separate run with immich-go upload from-google-photos for just the google takeout directory, so I think I have everything imported I need to import now.

(i started with -session-tag for the first run, but now using --tag to avoid API churn).

What do you mean by to avoid API churn? I'm working on a better tag assignment

When I did my 2nd run of immich-go upload from-folder, it had a lot of photos that the server already had, but immich-go wanted to tag them again. It did so, which seemed to trigger a lot of jobs on the server. In any case, I want one tag for this whole upload, not one per upload attempt. I'm unsure if immich-go should try to tag an asset that it's not uploaded because the server already has it. I can make the argument both ways...

@simulot
Copy link
Owner

simulot commented Jan 24, 2025

the session tag is useful to check what has been touched by immich-go.
It's easy to remove the tag, or delete photos just imported

@simulot simulot self-assigned this Jan 26, 2025
simulot added a commit that referenced this issue Jan 26, 2025
simulot added a commit that referenced this issue Jan 26, 2025
* fix: correct typo in bulkBatchSize constant name in BulkTagManager

* fix 0.23.0-RC9 eventually hanging #646: enhance metadata handling for immich-go exports in parseDir method

* Merge branch 'next' into simulot/issue638

* fix: tags root/tag

* Add caching for tag IDs to reduce upsert calls

- Introduce new SyncMap for tag IDs
- Modify upsert logic to check cache first
- Update tests to verify upsert count
- Adjust mock client to track upsert calls
- Ensure assets are tagged correctly

* Refactor asset upload and replace logic to use a callValues map for better tracing

  - Introduce callValues map for asset metadata
  - Simplify field writing in multipart form
  - Remove redundant file stat calls
  - Update trace logging for callValues
  - Clean up unused context keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants