Skip to content

[GSK-1235] Fix segmentation fault problems when running pytest#1164

Merged
andreybavt merged 14 commits intomainfrom
task/fix-tests-segfault
Jun 20, 2023
Merged

[GSK-1235] Fix segmentation fault problems when running pytest#1164
andreybavt merged 14 commits intomainfrom
task/fix-tests-segfault

Conversation

@mattbit
Copy link
Copy Markdown
Member

@mattbit mattbit commented Jun 9, 2023

Should solve the problems with fixtures tripadvisor and fraud_detection when running pytest locally on certain environments. @AbSsEnT could you check that this also solves the problem on your machine?

@mattbit mattbit requested a review from andreybavt June 9, 2023 12:35
Comment thread python-client/tests/fixtures/tripadvisor_text_classification_torch.py Outdated
@mattbit mattbit requested a review from andreybavt June 13, 2023 07:40
@AbSsEnT
Copy link
Copy Markdown
Contributor

AbSsEnT commented Jun 13, 2023

@mattbit will check it in 20 minutes

@AbSsEnT
Copy link
Copy Markdown
Contributor

AbSsEnT commented Jun 13, 2023

@mattbit I am still getting segfault for the fraud_detection fixture.

@mattbit mattbit changed the title [GS-1235] Fix segmentation fault problems when running pytest [GSK-1235] Fix segmentation fault problems when running pytest Jun 14, 2023
@linear
Copy link
Copy Markdown

linear Bot commented Jun 14, 2023

GSK-1235 Segfault during unit-testing.

  • Environment: Python 3.10, MacOS
  • Branch: ai-test-v2-merged
  • Error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
  • Description: If I run unit-testing, I am getting above error.
    1. First, I investigated, that this problem appears, during initialisation of the tripadvisor_text_classification_torchfixture, specifically, under the hood of the DistillBert PyTorch model initialisation. Exact operation, when this error happens is copy_of one tensor values to another. I fixed this problem by adding import torch in the __init__.py of the tests module.
    2. After above fix, this error again appears during execution of the test with fraud_detection__binary_classification fixture. Specifically execution fails, when LGBM classifier model is fit. Exact operation, where an error appears is _LIB.LGBM_DatasetCreateFromMat, where _LIBis a cdll and is loaded using ctypes.cdll.LoadLibrary. As in previous step I tried to fix this problem by importing ctypes module inside tests/__init__.py, but It did not help. For this moment it is not fixed.
    3. Segfault does not appear if run code outside of the unit-testing regime.

@andreybavt
Copy link
Copy Markdown
Contributor

@AbSsEnT , can you test it again to see if you still get a segfault?

@AbSsEnT
Copy link
Copy Markdown
Contributor

AbSsEnT commented Jun 15, 2023

@AbSsEnT , can you test it again to see if you still get a segfault?

@andreybavt still getting segfault for the fraud_detection fixture.

@mattbit
Copy link
Copy Markdown
Member Author

mattbit commented Jun 20, 2023

@andreybavt can we merge this?

@andreybavt
Copy link
Copy Markdown
Contributor

@mattbit , do we still need to make changes to the lightgbm version to solve Mykyta's issue?

@mattbit
Copy link
Copy Markdown
Member Author

mattbit commented Jun 20, 2023

@mattbit , do we still need to make changes to the lightgbm version to solve Mykyta's issue?

It would be useful because it removes a few unnecessary steps (download of stopwords which are not used), avoids downloading and initializing DistilBERT at import time, and frees memory since model is now loaded in the test scope.

@andreybavt andreybavt merged commit fb218ea into main Jun 20, 2023
@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants