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

[12.0][FIX] - report_py3o: run libreoffice in an isolated user installation #365

Merged
merged 1 commit into from Jan 23, 2020

Conversation

sbejaoui
Copy link
Contributor

@sbejaoui sbejaoui commented Jan 23, 2020

Bug when more than one conversion print is launched within the same libreoffice instance.

The standard behavior of libreoffice when a user open it while another instance is
running is to show a new window and throw an error if a new instance is forced within
the same user installation see.

This implies a bug in report_py3o module when we call libreoffice at the same time for
different documents.

To reproduce this bug:

Case 1:

  1. Simultaneously print two documents.

Case 2:

  1. Run print jobs using job_queue module
  2. Manually print another document

Case 3:
2. Open libreoffice
3. Print a py3o report

This PR creates a temporary user installation for each libreoffice conversion to bypass this limitation.

cc/ @sbidoul

@sbejaoui sbejaoui changed the title [12.0][FIX] - report_py3o: run lo in a separate user installation [12.0][FIX] - report_py3o: run libreoffice in an isolated user installation Jan 23, 2020
self.ir_actions_report_id.py3o_filetype,
result_path,
],
tmp_user_installation,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to return tmp_user_installation to the caller? Can't we clean it here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, we need this to exist for the actual call to libreoffice to succeed. But I'm also concerned about breaking the API here, I'd prefer to see the the temporary directory passed in an optional keyword argument. If passed, we add the parameter to the command, and the caller is responsible for cleaning up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I skimmed on it too quickly. So yes, better doing a with TemporaryDirectory() in the caller and pass the temp dir to _convert_single_report.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a new version to not break the API

@sbidoul
Copy link
Member

sbidoul commented Jan 23, 2020

@hbrunn @lmignon do you have an opinion about this? Have you ever encountered this issue?

@hbrunn
Copy link
Member

hbrunn commented Jan 23, 2020

I'm a little bit surprised by the repeated mention of the fusion server, as this is exactly the code path where we don't use the fusion server.

Myself I never encountered the issue described, but then we also use this only for a handful of reports that are very unlikely to be run anywhere close to parallel. That said, the bug description makes sense to me, I immediately believe this can be a problem. So as soon as this doesn't break the API, I'd be fine with the change.

@sbejaoui sbejaoui force-pushed the 12.0-fix_py3o_print_simultaneously branch from 77a74ec to a40314c Compare January 23, 2020 13:31
@sbejaoui
Copy link
Contributor Author

I'm a little bit surprised by the repeated mention of the fusion server, as this is exactly the code path where we don't use the fusion server.

Thank you for your review,

I misunderstood the usage of the fusion server as I am not familiar with the module. I updated the PR description.

@sbejaoui sbejaoui force-pushed the 12.0-fix_py3o_print_simultaneously branch from a40314c to 6b137a0 Compare January 23, 2020 13:44
@sbejaoui sbejaoui requested a review from sbidoul January 23, 2020 13:46
Copy link
Sponsor Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

report_py3o/models/py3o_report.py Outdated Show resolved Hide resolved
…lation

Bug when more than one conversion print is launched within the same libreoffice instance.

The standard behavior of libreoffice when a user open it while another instance is
running is to show a new window and throw an error if a new instance is forced within
the same user installation [see](https://bugs.documentfoundation.org/show_bug.cgi?id=37531).

This implies a bug in report_py3o module when we call libreoffice at the same time for
different documents.

To reproduce this bug:

**Case 1:**
1.  Simultaneously print two documents.

**Case 2:**
1.  Run print jobs using job_queue module
2.  Manually print another document

**Case 3:**
2.  Open libreoffice
3.  Print a py3o report

This PR creates a temporary user installation for each libreoffice conversion to bypass this limitation.
@sbejaoui sbejaoui force-pushed the 12.0-fix_py3o_print_simultaneously branch from 6b137a0 to e55f91a Compare January 23, 2020 13:57
@sbidoul
Copy link
Member

sbidoul commented Jan 23, 2020

/ocabot merge patch

OCA-git-bot added a commit that referenced this pull request Jan 23, 2020
Signed-off-by sbidoul
@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 12.0-ocabot-merge-pr-365-by-sbidoul-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Jan 23, 2020
Signed-off-by sbidoul
@OCA-git-bot
Copy link
Contributor

It looks like something changed on 12.0 in the meantime.
Let me try again (no action is required from you).
Prepared branch 12.0-ocabot-merge-pr-365-by-sbidoul-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit e55f91a into OCA:12.0 Jan 23, 2020
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at dccd888. Thanks a lot for contributing to OCA. ❤️

@sbidoul sbidoul deleted the 12.0-fix_py3o_print_simultaneously branch January 23, 2020 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants