Ticket #2850 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Running a python script while an algorithm is running crashes again

Reported by: Mathieu Doucet Owned by: Martyn Gigg
Priority: blocker Milestone: Iteration 28
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Michael Reuter

Description

The old problem of running a python script while an algorithm is running is back. I had fixed that problem when it first was discovered a month ago. A that time it was due to the algorithm functions in mantidsimple being refreshed while the python interpreter was running. My fix solved 99% of the seg faults, and the theory was that the remaining 1% would be solved once we get rid of mantidsimple. The current problem doesn't seem to be related to the algorithm refresh (which is turned off by default). I don't know what the problem is but it must be solved before release.

Change History

comment:1 Changed 9 years ago by Mathieu Doucet

To reproduce the problem:

while True:
   CreateWorkspace("test",1,1,1)

Then load another python script in a new tab.

Then load yet another python script in that new tab. The application will seg fault (at least on Ubuntu 10.10).

comment:2 Changed 9 years ago by Mathieu Doucet

(In [11059]) The problem seems to be with deleting the Script object. Removing the delete statement probably creates a small memory leak, but it is unlikely to cause a real problem until MantidPlot is more stable. This is better than a seg fault until a real fix is implemented. Someone should be tasked to clean up this code. Re #2850

comment:3 Changed 9 years ago by Nick Draper

  • Status changed from new to accepted

comment:4 Changed 9 years ago by Nick Draper

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

comment:5 Changed 9 years ago by Janik Zikovsky

  • Status changed from verify to verifying
  • Tester set to Janik Zikovsky

comment:6 Changed 9 years ago by Janik Zikovsky

  • Status changed from verifying to reopened
  • Resolution fixed deleted

On Ubuntu 10.10.

I found that opening scripts in a new tab did NOT cause the segfault. However, while running

while True:
   CreateWorkspace("test",1,1,1)

I started an algorithm (LoadEventNexus) using the GUI, which seemed to start slightly before segfaulting.

CreateWorkspace-[Notice] CreateWorkspace successful, Duration 0.00 seconds
CreateWorkspace-[Information] Algorithm: CreateWorkspace v1
CreateWorkspace-[Information] Parameters:
CreateWorkspace-[Information]   Name: OutputWorkspace, Value: test, Default?: No, Direction: Output
CreateWorkspace-[Information]   Name: DataX, Value: 1, Default?: No, Direction: Input
CreateWorkspace-[Information]   Name: DataY, Value: 1, Default?: No, Direction: Input
CreateWorkspace-[Information]   Name: DataE, Value: 1, Default?: No, Direction: Input
CreateWorkspace-[Information]   Name: NSpec, Value: 1, Default?: Yes, Direction: Input
CreateWorkspace-[Information]   Name: UnitX, Value: , Default?: Yes, Direction: Input
CreateWorkspace-[Information]   Name: VerticalAxisUnit, Value: SpectraNumber, Default?: Yes, Direction: Input
CreateWorkspace-[Information]   Name: VerticalAxisValues, Value: , Default?: Yes, Direction: Input
CreateWorkspace-[Information]   Name: Distribution, Value: 0, Default?: Yes, Direction: Input
CreateWorkspace-[Information]   Name: YUnitLabel, Value: , Default?: Yes, Direction: Input
CreateWorkspace-[Information]   Name: WorkspaceTitle, Value: , Default?: Yes, Direction: Input
CreateWorkspace-[Notice] CreateWorkspace successful, Duration 0.00 seconds
Segmentation fault

comment:7 Changed 9 years ago by Martyn Gigg

This is happening on Windows as well, I'll take a look.

comment:8 Changed 9 years ago by Martyn Gigg

  • Status changed from reopened to accepted
  • Owner changed from Nick Draper to Martyn Gigg

comment:9 Changed 9 years ago by Martyn Gigg

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

So the problem only occurs for extremely tight loops, i.e it does not occur with this

import time
while True:
   CreateWorkspace("test",1,1,1)
   time.sleep(0.1)

I think this is an edge case that users are unlikely to encounter so I have opened a fresh ticket for iteration 29, #2883.

comment:10 Changed 9 years ago by Michael Reuter

  • Status changed from verify to verifying
  • Tester changed from Janik Zikovsky to Michael Reuter

comment:11 Changed 9 years ago by Michael Reuter

  • Status changed from verifying to closed

I also cannot reproduce Mathieu's original issue, but I can reproduce the one Janik found. Using Martyn's script cures the problem. I think the original issue has been solved and a ticket has be duly created for the newly discovered issue.

comment:12 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 3697

Note: See TracTickets for help on using tickets.