I have a test script for which I’m using selenium along with pytest. Sometimes I get an error saying ‘fatal Python erorr: Bus error’. Im not using sockets, threads or anything else that requires use of memory allocation and even pointers. I’ve attached screenshots for reference.
I’m also using jpype so that i can use extent report for reporting purposes and the first line in the screenshot that is giving the error in the conftest.py in fin is as follows:
@pytest.fixture(scope="session")
def report_util(request):
timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
extent = ExtentReports()
if not os.path.exists("../reports/"):
os.makedirs("../reports/")
extent_reporter = ExtentSparkReporter(f'../reports/report_{timestamp}.html')
extent_reporter.config().thumbnailForBase64(True)
extent_reporter.config().setCss("img {width: 400px;}")
extent.attachReporter(extent_reporter)
def fin():
try:
extent.flush()
jp.shutdownJVM()
except Exception as e:
print(f"Exception during teardown: {e}")
raise
request.session.addfinalizer(fin)
return extent
[enter image description here](https://i.sstatic.net/MR5Cv6pB.png)
I tried mprof to see if there are any memory leaks… but the error doesn’t happen always. So its quite hard to find the issue as when i was trying to do memory profiling i didnt got the same error.
Aeraf khan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.