From 0938804947687c0bbd73a6e4deed1f141a634f25 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Wed, 27 Mar 2019 10:52:42 +0100 Subject: [PATCH] fix(xo-server/worker): forget remote after use (#4079) Fixes xoa-support#1378 Fixes xoa-support#1384 Fixes xoa-support#1399 --- CHANGELOG.unreleased.md | 3 ++- packages/xo-server/src/xo-mixins/workers/worker.js | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index c988b92a8..483153a40 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -2,7 +2,7 @@ ### Enhancements -- [Remote] Benchmarks (read and write rate speed) added when remote is tested [#3991](https://github.com/vatesfr/xen-orchestra/issues/3991) (PR [#4015](https://github.com/vatesfr/xen-orchestra/pull/4015)) +- [Remotes] Benchmarks (read and write rate speed) added when remote is tested [#3991](https://github.com/vatesfr/xen-orchestra/issues/3991) (PR [#4015](https://github.com/vatesfr/xen-orchestra/pull/4015)) - [Cloud Config] Support both NoCloud and Config Drive 2 datasources for maximum compatibility (PR [#4053](https://github.com/vatesfr/xen-orchestra/pull/4053)) - [Advanced] Configurable cookie validity (PR [#4059](https://github.com/vatesfr/xen-orchestra/pull/4059)) - [Plugins] Display number of installed plugins [#4008](https://github.com/vatesfr/xen-orchestra/issues/4008) (PR [#4050](https://github.com/vatesfr/xen-orchestra/pull/4050)) @@ -10,6 +10,7 @@ ### Bug fixes - [Home] Always sort the items by their names as a secondary sort criteria [#3983](https://github.com/vatesfr/xen-orchestra/issues/3983) (PR [#4047](https://github.com/vatesfr/xen-orchestra/pull/4047)) +- [Remotes] Fixes `spawn mount EMFILE` error during backup - Properly redirect to sign in page instead of being stuck in a refresh loop ### Released packages diff --git a/packages/xo-server/src/xo-mixins/workers/worker.js b/packages/xo-server/src/xo-mixins/workers/worker.js index 2f4d6c55c..883121781 100644 --- a/packages/xo-server/src/xo-mixins/workers/worker.js +++ b/packages/xo-server/src/xo-mixins/workers/worker.js @@ -1,5 +1,6 @@ // @flow +import defer from 'golike-defer' import { type Remote, getHandler } from '@xen-orchestra/fs' import { mergeVhd as mergeVhd_ } from 'vhd-lib' @@ -12,7 +13,8 @@ global.Promise = require('bluebird') // $FlowFixMe const config: Object = JSON.parse(process.env.XO_CONFIG) -export async function mergeVhd( +export const mergeVhd = defer(async function( + $defer: any, parentRemote: Remote, parentPath: string, childRemote: Remote, @@ -21,9 +23,11 @@ export async function mergeVhd( const parentHandler = getHandler(parentRemote, config.remoteOptions) const childHandler = getHandler(childRemote, config.remoteOptions) - // DO NOT forget the handlers as it they are still in use in the main process await parentHandler.sync() + $defer.call(parentHandler, 'forget') + await childHandler.sync() + $defer.call(childHandler, 'forget') return mergeVhd_(parentHandler, parentPath, childHandler, childPath) -} +})