question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Version 1.1.1 causes Segfault if run with pytest-mypy on large codebase

See original GitHub issue

I’m using httpretty with pytest and pytest-mypy on a larger codebase (~ 404 tests, 97 times @httpretty.httprettified).

When running pytest --mypy on this code base, I am getting a Segmentation Fault after ~49% of all tests passed:

tests/tagger/test_sentence_tagger_factory.py .........                                                                                                                                                                                                                                                               [ 49%]
tests/tagger/test_tagger_factory.py ......FFatal Python error: Segmentation fault

Thread 0x000070000ed4b000 (most recent call first):
  File "/usr/local/Caskroom/miniconda/base/envs/[PROJECT]/lib/python3.8/threading.py", line 306 in wait
  File "/usr/local/Caskroom/miniconda/base/envs/[PROJECT]/lib/python3.8/threading.py", line 558 in wait
  File "/usr/local/Caskroom/miniconda/base/envs/[PROJECT]/lib/python3.8/site-packages/tqdm/_monitor.py", line 60 in run
  File "/usr/local/Caskroom/miniconda/base/envs/[PROJECT]/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/usr/local/Caskroom/miniconda/base/envs/[PROJECT]/lib/python3.8/threading.py", line 890 in _bootstrap

Current thread 0x000000011cd9edc0 (most recent call first):
  File "/usr/local/Caskroom/miniconda/base/envs/[PROJECT]/lib/python3.8/site-packages/httpretty/core.py", line 385 in __getattr__
  File "/usr/local/Caskroom/miniconda/base/envs/[PROJECT]/lib/python3.8/site-packages/httpretty/core.py", line 385 in __getattr__
[…line repeats 76 times in total…]
  File "/usr/local/Caskroom/miniconda/base/envs/[PROJECT]/lib/python3.8/site-packages/httpretty/core.py", line 385 in __getattr__
  ...
Segmentation fault: 11

With version 1.1.0, everything is fine.

Looking into the changes, and finding that said line 385 in core.py is

    def __getattr__(self, name):
        return getattr(self.file, name)

,

I tried undoing this change https://github.com/gabrielfalcao/HTTPretty/compare/1.1.0...1.1.1#diff-326a996e75c88c9fc8dabbfdca5029c2a409fac6a2dd9b7dffa9f3726bce7c55L367,

i.e. changed it back to

    def close(self):
        self.socket.close()
        self.file.close()

and lo, the segfault no longer happens; all tests pass.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gleuschcommented, May 20, 2021

Awesome! Thank you for writing and maintaining such an extremely useful tool!

1reaction
gabrielfalcaocommented, May 19, 2021

Thanks for the report @gleusch I’ll get this fixed for the next release. Will keep you posted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What causes a Python segmentation fault? - Stack Overflow
The program runs great on small data set, but when I run it on a super-large graph (more than 800,000 nodes), it says...
Read more >
Identify what's causing segmentation faults (segfaults)
Segfaults are caused by a program trying to read or write an illegal ... A segfault occurs when a reference to a variable...
Read more >
int(s), float(s) and others may cause segmentation fault
Typical cause of these crash is bug in 3rd party extensions. ... It's happens during Django tests on a very large code base....
Read more >
Dr Ruby Upgrade or: How We Learned To Stop Seg-Faulting ...
The bug was obviously caused by the Ruby upgrade, but how to fix it was unclear from the stack trace and the captured...
Read more >
Race/segmentation fault on process shutdown in OpenSSL
Version -Release number of selected component (if applicable): openssl-1.1.1-8.el8.x86_64 How reproducible: common Steps to Reproduce: 1. Run an application ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found