tree 3d665a651996d86e564ea6fa9c990c05e7f593c6 parent d4fbdb01390230d02d4b33c9b4ad721321f22d67 author rattus <46076784+rattus128@users.noreply.github.com> 1762554680 +1000 committer GitHub 1762554680 +0100 gpgsig -----BEGIN PGP SIGNATURE----- wsFcBAABCAAQBQJpDnM4CRC1aQ7uu5UhlAAAIQQQAGhLPK3SczyixyuOxRyctMJ3 4JvHw8spOTJool0QzY4PvyrLSrITz5Vz0ctrKMVOy2xvJJTDrCg9t90jFTDTUPuN 9SHK23TcwExr62mSbMdcL5WnhpUyI3PKDO/6yM3Fxxtx/f6gxxkndrYly6Hj6JEV og5zY8lIItV+pNQ4Flm+rTlEGdxRunfXJ2fjHR5//TWRnJvZTCrW0JsLh+QkBaCs prqXxJK4EGibFENhPk+peXoHnQMMlrTTRF7IqWauJ2mCZA1+l92msjTAPFrUwPdl I14ws8wUerxSDQX+S6OJe40Stu7gfkZ1Gr2gCwpUXzX+7jJK7qgsDqDeu8MfblQS AoRoS8p+SSeSPufQRlICx3NkAczy+IrfUOeV8itfSFGw0Bh6R+HLYaJPjqfE1xgy yLpbZ0TplkR8gjfVyD/NBNzKkvHdoMB8Pp7MhpwtWkdYBUX5pRObw9FqxXKPR0BJ hG+hWuATafSuKzhuoADObvmRLqajAbHbp3AhP/NdJ4p+mTQ6s6mZn1BYEjRWyI5Y DgXPr7tZzxkcIMpEFTy9oX24av9Z7OKGwFUTmUaG5NRYXqqUEf/tFU3qKKMnpMmm 7qMqfySspSwIUlxn5o2K/eZ0ybueokU7XysQrnv1TjUA8XosHEk28N0/jPlRvnnr 8EfgFlbwjr/RsXOvMThg =ai1V -----END PGP SIGNATURE----- add default named_modules_to_munmap variable (#357) * add default named_modules_to_munmap variable Default this to handle to case of cloning a GGUFModelPatcher which then expects it to exist on the clone. I could never reproduce this condition, however 4 users have the error. This error path is very sensitive to VRAM condtions and workflow and I never got the details so its a bit of a guess. But from a code point of view, its the right thing anyway * nodes: carry the mmap_released state through a clone() There are workflows where the same underlying model will be loaded twice by two different ModelPatchers. With the current code as-is, the first patcher will load fine and intercept the pins while removing already done pins from the free modules list. It then will load again with the second MP however, this one will not get the callbacks for the already pinned stuff and then rip through and .to().to() them all. This destroys the pinning setup while comfy core still keeps the modules registered as unpinned. This causes a crash on einval when core goes to unpin the not pinned tensors. Comfy core now has a guard against unpinning the not-pinned, however what I think is happening, is the RAM of the pin in freed in the .to().to() and then malloc re-allocates it to new tensors with cuda keeping its records of previous pinning. einval can happen when you try and unpin a tensor in the middle of the block which is definately possible on this use after free pattern.