Ticket #1548 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

MantidPlot Debug Crashes on Python Error

Reported by: Michael Whitty Owned by: Martyn Gigg
Priority: minor Milestone: Release 2.1
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Peter Parker

Description

This is in relation to the comments I made in #1305

Since it only seems to affect debug, I'm assigning it a minor priority

This was reproducable in build of svn [5943]

I've only tested this on Win32 as I don't have access to other debug builds. I've attached as much information as I think could be useful.

Debug console outputs:

Algorithm-[Information] Algorithm: LoadNexus v1
Algorithm-[Information] Parameters:
Algorithm-[Information]   Name: Filename, Value: C:/Documents and Settings/tzh47
418/My Documents/MANTID/Code/Mantid/release/irs21360_graphite002_ipg.nxs, Defaul
t?: No, Direction: Input
Algorithm-[Information]   Name: OutputWorkspace, Value: irs21360_graphite002_ipg
, Default?: No, Direction: Output
Algorithm-[Information]   Name: SpectrumMin, Value: 1, Default?: Yes, Direction:
 Input
Algorithm-[Information]   Name: SpectrumMax, Value: 2147483632, Default?: Yes, D
irection: Input
Algorithm-[Information]   Name: SpectrumList, Value: , Default?: Yes, Direction:
 Input
Algorithm-[Information]   Name: EntryNumber, Value: 0, Default?: Yes, Direction:
 Input
LoadNexusProcessed-[Information] Axis 1 set to unitless quantity "spectraNumber"

AnalysisDataService-[Information]  add Data Object 'irs21360_graphite002_ipg' su
ccessful
Algorithm-[Notice] LoadNexus successful, Duration 0.50 seconds
Algorithm-[Information] Algorithm: Elwin v1
Algorithm-[Information] Parameters:
Algorithm-[Information]   Name: InputWorkspace, Value: irs21360_graphite002_ipg,
 Default?: No, Direction: Input
Algorithm-[Information]   Name: OutputWorkspace, Value: irs21360_elw, Default?:
No, Direction: Output
Algorithm-[Information]   Name: EnergyRange, Value: -0.1,0.1, Default?: Yes, Dir
ection: Input
Algorithm-[Information]   Name: EFixed, Value: 1.845, Default?: No, Direction: I
nput
Algorithm-[Information] Algorithm: Integration v1
Algorithm-[Information] Parameters:
Algorithm-[Information]   Name: InputWorkspace, Value: irs21360_graphite002_ipg,
 Default?: No, Direction: Input
Algorithm-[Information]   Name: OutputWorkspace, Value: _elwin_tmp_ws, Default?:
 No, Direction: Output
Algorithm-[Information]   Name: RangeLower, Value: -0.10000000000000001, Default
?: No, Direction: Input
Algorithm-[Information]   Name: RangeUpper, Value: 0.10000000000000001, Default?
: No, Direction: Input
Algorithm-[Information]   Name: StartWorkspaceIndex, Value: 0, Default?: Yes, Di
rection: Input
Algorithm-[Information]   Name: EndWorkspaceIndex, Value: 50, Default?: No, Dire
ction: Input
Algorithm-[Information]   Name: IncludePartialBins, Value: 0, Default?: Yes, Dir
ection: Input
AnalysisDataService-[Information]  add Data Object '_elwin_tmp_ws' successful
Algorithm-[Notice] Integration successful, Duration 0.03 seconds
AnalysisDataService-[Information] Data Object '_elwin_tmp_ws' deleted from data
service.
Fatal Python error: PyThreadState_Get: no current thread

Locals:

-		msg	0x04a7bddc "PyThreadState_Get: no current thread"	const char *
			80 'P'	const char

Call stack:

 	ntdll.dll!7c90120e() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
>	python25_d.dll!Py_FatalError(const char * msg=0x04a7bddc)  Line 1558 + 0x8 bytes	C
 	python25_d.dll!PyThreadState_Get()  Line 310 + 0xa bytes	C
 	MantidPythonAPI_d.pyd!Mantid::PythonAPI::pythonIsReady()  Line 36 + 0x6 bytes	C++
 	MantidPythonAPI_d.pyd!Mantid::PythonAPI::PyCall_NoArg<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const >::dispatch(_object * object=0x137dfae8, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & func_name="name")  Line 141 + 0x5 bytes	C++
 	MantidPythonAPI_d.pyd!Mantid::PythonAPI::PyAlgorithmCallback::name()  Line 60 + 0x2c bytes	C++
 	MantidAPI.dll!Mantid::API::AlgorithmHistory::AlgorithmHistory(const Mantid::API::Algorithm * const alg=0x111fa530, const __int64 & start=1282815257, const double & duration=0.093999996781349182, unsigned int uexeccount=30)  Line 22 + 0x50 bytes	C++
 	MantidAPI.dll!Mantid::API::Algorithm::fillHistory(__int64 start=1282815257, double duration=0.093999996781349182, unsigned int uexecCount=30)  Line 492 + 0x1e bytes	C++
 	MantidAPI.dll!Mantid::API::Algorithm::execute()  Line 261	C++
 	MantidAPI.dll!Mantid::API::Algorithm::executeAsyncImpl(const Poco::Void & __formal={...})  Line 874 + 0xd bytes	C++
 	MantidAPI.dll!Mantid::API::AlgorithmProxy::executeAsyncImpl(const Poco::Void & dummy={...})  Line 194	C++
 	MantidAPI.dll!Poco::ActiveRunnable<bool,Poco::Void,Mantid::API::AlgorithmProxy>::run()  Line 85 + 0x4e bytes	C++
 	PocoFoundationd.dll!Poco::PooledThread::run()  Line 201 + 0x15 bytes	C++
 	PocoFoundationd.dll!Poco::ThreadImpl::entry(void * pThread=0x0d7a3e94)  Line 158 + 0x13 bytes	C++
 	kernel32.dll!7c80b729() 	

Reproduction steps: Run the custom interface "indirectAnalysis", on Elwin tab enter attached file and put -0.1, 0.1 in window start and window end, then click on run.

Going through the same steps in release build do not cause any errors.

Attachments

irs21360_graphite002_ipg.nxs (1.5 MB) - added by Michael Whitty 10 years ago.
Input file to cause crash

Change History

Changed 10 years ago by Michael Whitty

Input file to cause crash

comment:1 Changed 10 years ago by Michael Whitty

  • type changed from enhancement to defect

comment:2 Changed 10 years ago by Nick Draper

  • Owner set to Martyn Gigg
  • Status changed from new to assigned
  • Component set to Mantid

is this reproducible in current debug builds?

comment:3 Changed 10 years ago by Michael Whitty

I was able to reproduce it in [6154]

comment:4 Changed 10 years ago by Martyn Gigg

So I think I understand what is happening here. It is to do with running C++ algorithms as child algorithms of a Python algorithm.

At the moment this is not set up correctly and calling one of the mantidsimple algorithms runs an algorithm, then after it completes stores the history which calls name on the PythonAlgorithm. This call requires the GIL lock but has come from a place where it wasn't expecting to need it.

comment:5 Changed 10 years ago by Nick Draper

  • Milestone changed from Iteration 26 to Iteration 27

Bulk move of tickets to iteration 27, if your ticket is essential for Iteration 26 then move it back.

comment:6 Changed 10 years ago by Nick Draper

  • Milestone changed from Iteration 27 to Iteration 28

Bulk move of tickets at the end of iteration 27

comment:7 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 28 to Iteration 29

Bulk move of tickets at the end of iteration 28

comment:8 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 29 to Iteration 30

Accepted and assigned tickets moved at iteration 29 code freeze

comment:9 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 30 to Iteration 31

Bulk move of tickets to iteration 31 at the iteration 30 code freeze

comment:10 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 32 to Iteration 33

Moved to iteration 33 at iteration 32 code freeze

comment:11 Changed 8 years ago by Martyn Gigg

  • Status changed from assigned to accepted

comment:12 Changed 8 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

Fixed as part of the asynchronous python work, #5006

comment:13 Changed 8 years ago by Peter Parker

  • Status changed from verify to verifying
  • Tester set to Peter Parker

comment:14 Changed 8 years ago by Peter Parker

  • Status changed from verifying to closed

Using latest code in VS's Debug mode, this runs fine for me.

comment:15 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 2395

Note: See TracTickets for help on using tickets.