[FIXED] popupmenu causes intuition freeze

This forum is for general developer support questions.
chris
Posts: 555
Joined: Sat Jun 18, 2011 11:05 am
Contact:

[FIXED] popupmenu causes intuition freeze

Post by chris »

Can anybody explain what is happening here? After opening a popupmenu.class object using PM_OPEN, I get the following crash and Intuition freezes (mouse and keyboard still work, but you can't do anything).

When this first started occuring I hadn't changed my popupmenu code, so I suspect memory is getting trashed somewhere.
Hidden Text - Click to Show :
Fault caused by load operation

Registers pointing to code:
r9 : module Kickstart/kernel at 0x01C997C4 (section 1 @ 0x497C8)
r13: NetSurf-Cairo:knockout_entries()+0x707C (section 26 @ 0x78B0)
r16: module Kickstart/intuition.library.kmod at 0x0157EACC (section 0 @ 0x7FD0)
r25: module LIBS:popupmenu.library at 0x57E2B3D8 (section 6 @ 0x3B8)
ip : module LIBS:popupmenu.library at 0x6FA9C30C (section 5 @ 0x32EC)
lr : module LIBS:popupmenu.library at 0x6FA9C2B8 (section 5 @ 0x3298)
ctr: module Kickstart/kernel at 0x01414BA4 (section 0 @ 0x14BA8)

Stack Backtrace:
(0x5A212350) module LIBS:popupmenu.library at 0x6FA9C30C (section 5 @ 0x32EC)
(0x5A212390) module LIBS:popupmenu.library at 0x6FA9D6D0 (section 5 @ 0x46B0)
(0x5A2123E0) module CLASSES:popupmenu.class at 0x6FC89354 (section 5 @ 0x2334)
(0x5A2124C0) module Kickstart/intuition.library.kmod at 0x0158EB7C (section 0 @ 0x18080)
(0x5A212520) module Kickstart/intuition.library.kmod at 0x0158EDA0 (section 0 @ 0x182A4)
(0x5A2125A0) module Kickstart/intuition.library.kmod at 0x0157EE28 (section 0 @ 0x832C)
(0x5A2125B0) module Kickstart/intuition.library.kmod at 0x0157EA68 (section 0 @ 0x7F6C)
(0x5A212620) NetSurf-Cairo:ami_context_menu_show()+0x197C (section 10 @ 0x66FC)
(0x5A212720) NetSurf-Cairo:ami_handle_msg()+0xEF4 (section 10 @ 0x132D8)
(0x5A212810) NetSurf-Cairo:ami_get_msg()+0x120 (section 10 @ 0x152D4)
(0x5A212840) NetSurf-Cairo:gui_poll()+0x40 (section 10 @ 0x15484)
(0x5A212860) NetSurf-Cairo:netsurf_main_loop()+0x2C (section 10 @ 0x7D67C)
(0x5A212870) NetSurf-Cairo:main()+0x150 (section 10 @ 0x11E50)
(0x5A212D00) module Kickstart/newlib.library.kmod at 0x0161B96C (section 0 @ 0x1F50)
(0x5A212D70) module Kickstart/newlib.library.kmod at 0x0161C600 (section 0 @ 0x2BE4)
(0x5A212F10) module Kickstart/newlib.library.kmod at 0x0161C77C (section 0 @ 0x2D60)
(0x5A212F50) NetSurf-Cairo:_start()+0x170 (section 10 @ 0x170)
(0x5A212F90) module Kickstart/dos.library.kmod at 0x0150AD64 (section 0 @ 0x1B528)
(0x5A212FC0) module Kickstart/kernel at 0x01436290 (section 0 @ 0x36294)
(0x5A212FD0) module Kickstart/kernel at 0x01436310 (section 0 @ 0x36314)
(0x5A212FE0)
(0x00000000) module Kickstart/kernel at 0x01DAD806 (section 1 @ 0x15D80A)
WARNING: Backchain pointer loops

Disassembly of crash site:
6FA9C2FC: 3BA00001 li r29,1
6FA9C300: 816B003C lwz r11,60(r11)
6FA9C304: 81490004 lwz r10,4(r9)
6FA9C308: 813BEA00 lwz r9,-5632(r27)
>6FA9C30C: 880B000F lbz r0,15(r11)
6FA9C310: 888A000F lbz r4,15(r10)
6FA9C314: 7D234B78 mr r3,r9
6FA9C318: 81290128 lwz r9,296(r9)
6FA9C31C: 7FA00030 slw r0,r29,r0
6FA9C320: 7FA42030 slw r4,r29,r4
Stack pointer (0x5A212350) is inside bounds
Redzone is OK (4)

68k register dump
DATA: 00000080 000000AA 00000000 00000000 00000000 00000000 00000000 00000000
ADDR: 00000000 5AAB4190 00000000 00000000 00000000 00000000 00000000 5A212380
Page information:
Page not found
Last edited by chris on Fri Jan 10, 2014 9:58 pm, edited 1 time in total.
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 354
Joined: Mon Jan 17, 2011 9:42 pm

Re: popupmenu causes intuition freeze

Post by Rigo »

I did experience a similar problem with popup menus in CodeBench. My solution was to push the popups into child tasks, and then signal the main task once the child quits. The result of the selection was stored in a shared variable.

I wasn't getting crashes, but was getting intuition deadlocks. I assume that something is going on where input.device is stuck in a loop waiting for menu selection, but of course it cannot move the mouse etc.

I haven't investigated this recently to see if things have changed, as the logic is working here.

Simon
chris
Posts: 555
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: popupmenu causes intuition freeze

Post by chris »

Thanks. I might wait until Update 3 just in case that fixes it, and then implement a task as per your suggestion if not.

Something I have just remembered - on the Amiga side it gives me Guru Meditation 80000003 which is apparently a CPU unaligned access error. Is it possible there is some alignment issue in popupmenu.class or intuition.library (or my own code) which causes problems on the PPC440EP? I can't remember when the alignment issues were fixed, but popupmenu.class has a date of June 2009, which might mean it hasn't been recompiled with the alignment fixes?
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1446
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: popupmenu causes intuition freeze

Post by tonyw »

I think you'll find that error code is applicable to any illegal memory access, whether it be misalignment, private memory, unallocated memory or whatever.
cheers
tony
chris
Posts: 555
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: popupmenu causes intuition freeze

Post by chris »

@rigo

Since Update 3 didn't fix it, I've decided to try your suggestion. I've created a task which simply calls IDoMethod(PM_OPEN) for testing, but it gives me an error that I'm trying to call Open() from a task (I'm not, and I'm not sure why PM_OPEN would be either), and then promptly deadlocks exactly the same as before but with this message on screen instead.

@tonyw

Is there any way I can find out what is accessing memory illegally or some way of tracking this down?

btw, even if I strip the entire menu creation out of my code, PM_OPEN still deadlocks. I effectively have this:

Code: Select all

ctxmenuobj = NewObject( POPUPMENU_GetClass(), NULL,TAG_DONE);
IDoMethod(ctxmenuobj,PM_OPEN,win);
I don't see how anything can be at fault here except popupmenu.class, unless something else is trashing popupmenu.class' memory - however I wouldn't expect that to happen so consistently. I've yet to try it on another computer although I'm not entirely sure what that will prove. popupmenu.class does work here, it just doesn't work in this program since some changes unrelated to this code - which is why I'm thinking it might be an alignment problem.

I was going to try updating it to use OpenClass() but I don't think I can, due to the weird hybrid POPUPMENU_GetClass/POPUPMENU_GetItemClass thing.

(I've also tried rearranging the linking order, changing compiler flags - optimisation etc - and still getting the deadlock, I'm out of ideas)
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 354
Joined: Mon Jan 17, 2011 9:42 pm

Re: popupmenu causes intuition freeze

Post by Rigo »

It's always difficult without working example code. Myself, I create the menu object and call PM_OPEN in the child process, and the result is stored some where where both the parent and child can access. I have had no problems with this so far.

Simon
chris
Posts: 555
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: popupmenu causes intuition freeze

Post by chris »

Rigo wrote:It's always difficult without working example code. Myself, I create the menu object and call PM_OPEN in the child process, and the result is stored some where where both the parent and child can access. I have had no problems with this so far.
Ah, are you using a process then and not a task?

I'm going to go back through old revisions of my code and see if I can figure out exactly what triggered the problem. I've confirmed that it deadlocks on another machine, so it must be something in the code somewhere which is upsetting popupmenu.class or Intuition.
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 354
Joined: Mon Jan 17, 2011 9:42 pm

Re: popupmenu causes intuition freeze

Post by Rigo »

It's a process that creates the menu due to needing to access a disk-bound config file in order to know what items to add.

Simon
chris
Posts: 555
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: popupmenu causes intuition freeze

Post by chris »

Well, I've tracked down the problem, it was caused by a simple AllocSignal(-1) before popupmenu.class was even opened.

I don't have time to create a test case right now, but AllocSignal() followed by the empty menu creation I posted earlier ought to show the problem. The signal does not need to be used, just allocated!
chris
Posts: 555
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: popupmenu causes intuition freeze

Post by chris »

I have been completely unable to create a test case for this, so there must be some other forces at play.
Post Reply