Skip to content

address race condition where assemblies exist on the server but aren'…#711

Open
alpapan wants to merge 1 commit intoGMOD:mainfrom
alpapan:sync_bug_fix
Open

address race condition where assemblies exist on the server but aren'…#711
alpapan wants to merge 1 commit intoGMOD:mainfrom
alpapan:sync_bug_fix

Conversation

@alpapan
Copy link
Contributor

@alpapan alpapan commented Oct 9, 2025

this is a defensive check to fix two issues that caused errors due to a sync and/or race condition between mongo and local storage

Error: Could not find assembly "68d645473455e153641748db" to add feature "68e7ad6ad1890725fdbfdab0"
(when adding a feature to an assembly that it can't find in its local state)

and

Error: [mobx-state-tree] You are trying to read or write to an object that is no longer part of a state tree. (Object type: 'ApolloInternetAccount', Path upon death: '/internetAccounts/0', Subpath: '', Action: '/internetAccounts/0.postUserLocation()')
(client-side state management)

…t loaded in the client state when features are being added; prevents the MobX State Tree error by checking session state before broadcastLocations
@alpapan
Copy link
Contributor Author

alpapan commented Oct 9, 2025

the error i tried to fix:


Screenshot 2025-10-10 023111

even after this commit,
i'm still getting this (more on firefox that edge):
Screenshot 2025-10-10 023147

this helped a bit
packages/jbrowse-plugin-apollo/src/ApolloInternetAccount/model.ts ~line 395

const debounceTimeout = 300
      const debouncePostUserLocation = (
        fn: (userLocation: UserLocation[]) => (Promise<void> | void),
      ) => {
        let timeoutId: ReturnType<typeof setTimeout>
        return (userLocation: UserLocation[]) => {
          clearTimeout(timeoutId)
          timeoutId = setTimeout(() => {
            if (isAlive(self)) {
              fn(userLocation)
            }
          }, debounceTimeout)
        }
      }

(generally i seem to have sync issues between client and database server - probably due to my setup - but hopefully these address it; not sure what's up)

@garrettjstevens
Copy link
Contributor

The error that refers to postUserLocation was due to some event listeners not getting properly cleaned up. I've opened a PR to fix it here: #714. I'm still looking into the "Could not find assembly" error.

@garrettjstevens
Copy link
Contributor

@alpapan I've been trying to reproduce the "Could not find assembly x to add feature y" error, and I know at least one other user has mentioned seeing it, but I can't get it to happen for me locally. If you have steps to reproduce it I can investigate further.

@alpapan
Copy link
Contributor Author

alpapan commented Oct 10, 2025

I wonder if all the issues I'm having is because of using a proxy...?

@garrettjstevens
Copy link
Contributor

I doubt it's the proxy, the postUserLocation error happened to me, too, without a proxy.

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

Successfully merging this pull request may close these issues.

2 participants