M4L poly~ NULL pointer parameter… i need your help :-)

Jul 16, 2012 at 11:39pm

M4L poly~ NULL pointer parameter… i need your help :-)

Hello,

I have composed a M4L instrument patch only for isolating a reproduceable crash. It consists of a poly~ which receives midi from ableton live. The poly~ hosts only one instance of a very simple patch that does output a pure sine wave for dummy processing. The midi from ableton triggers a message (“TestCall TestSymbol”) to a simple external, which does in fact nothing.
The problem is, that this TestCall-message sometimes forces the external to crash because of a corrupted t_symbol function parameter. Either the parameter is a NULL pointer or the t_symbol->t_name is a NULL pointer or it's a an illegal pointer even if it's not NULL.

This crash only occurs when the ableton live multiprocessor feature is enabled. And it's necessary to open more the one instance of the M4L instrument. I usually test with a number of at least four instances.

Please, has anyone an idea why this happens ? Is there anything obviously wrong with me ?

The zip file contains a frozen M4L device including the external and a ableton live set for testing. Also the c source code of the external is included.

Thank you for your attention. :-)

cheers
jan

M4L instrument:

– Pasted Max Patch, click to expand. –

Poly~ patch (“ExternalTestInsidePoly.maxpat”):

– Pasted Max Patch, click to expand. –

And the c source extract of the mentioned external. This function is called by the message “TestCall TestSymbol”:

void ExternalTest_TestCall(t_ExternalTest *x, t_symbol *SymParam)
{
if(SymParam == NULL)
{
error("%s: TestCall parameter corrupt!",OBJECT_NAME);
return;
}

if(SymParam->s_name == NULL)
{
error("%s: TestCall parameter (s_name) corrupt!",OBJECT_NAME);
return;
}
}

Win XP32 SP3
Ableton Live 8.3.2
Max/MSP 5.1.9 (authorized via M4L)
Max/MSP SDK 5.1.7

HW:
System1: Intel Core2 T7200 with 2GB Ram
System2: Intel Core2 Quad 2.3GHz with 4GB Ram

[attachment=199528,4193]

Attachments:
  1. maxruntimewindowerror.png
#34086
Jul 18, 2012 at 12:36pm

Please, could someone look at this issue ? I have spent a lot of time to investigate this. And it may be useful to know for M4L developers, I think. Perhaps I’m totally wrong…

#114522
Jul 20, 2012 at 2:34pm

i have updated the external (previously written for max4) to the “new” function calls (e.g. class_new, class_addmethod, …).
But this does not change anything.
The issue remains.

#114523
Jul 20, 2012 at 2:38pm

And the source of the external…. nothing special, just for testing.

#include "ext.h"
#include "ext_obex.h"
#include "z_dsp.h"

void *ExternalTest_class;

#define OBJECT_NAME "ExternalTest~"

typedef struct _ExternalTest
{
  t_pxobject x_obj;
} t_ExternalTest;

void *ExternalTest_new(t_symbol *msg, short argc, t_atom *argv);
void ExternalTest_free(t_ExternalTest *x);
void ExternalTest_TestCall(t_ExternalTest *x, t_symbol *SymParam);

void *ExternalTest_class;

void main(void)
{
	t_class *c;
	c = class_new(OBJECT_NAME, (method)ExternalTest_new, (method)ExternalTest_free, (long)sizeof(t_ExternalTest), 0L , A_GIMME, 0);

	class_register(CLASS_BOX, c);
	class_addmethod(c, (method)ExternalTest_TestCall, "TestCall", A_SYM, 0);

	ExternalTest_class = c;
	post("I am the ExternalTest object");
}

void *ExternalTest_new(t_symbol *msg, short argc, t_atom *argv)
{
  	t_ExternalTest *x = NULL;

	if (x = (t_ExternalTest *)object_alloc(ExternalTest_class))
	{
		object_post((t_object *)x, "a new %s object was instantiated: 0x%X", msg->s_name, x);
	}

  x->x_obj.z_misc |= Z_NO_INPLACE; 

  return (x);
}

void ExternalTest_free(t_ExternalTest *x)
{
  ;
}

void ExternalTest_TestCall(t_ExternalTest *x, t_symbol *SymParam)
{
  if(SymParam == NULL)
  {
	object_error((t_object *)x, "TestCall parameter corrupt!");
	return;
  }

  if(SymParam->s_name == NULL)
  {
	object_error((t_object *)x, "TestCall parameter (s_name) corrupt!");
    return;
  }
}
#114524
Jul 20, 2012 at 3:24pm

Hello,

1. Is the crash specific with M4L ? Can you provide a MaxMSP version ? As i do not have M4L i can not currently help with your amxd scenario.

2. Have you sent a well formatted bug report to cycling74 ‘s team ?

#114525
Jul 20, 2012 at 4:27pm

We do not offer support for external development via standard support channels.
Is the problem evident in a Max 6 patcher or Max for Live device?

Cheers

Andrew

#114526
Jul 20, 2012 at 4:31pm

Hello Nicolas,

ad 1) Yes, it is specific to M4L since the crash does not occur when multiprocessor support of Ableton Live is disabled.
ad 2) Yes, but the short answer was, that they don’t give support for 3rd-party externals and I should paste my findings into the developer forum.

thanks.

#114527
Jul 20, 2012 at 4:49pm

Hi Andrew,

I have tested this within the M4L-Runtime.

Installed is
Live 8.3.2
Max 5.1.9

#114528
Jul 20, 2012 at 5:08pm

Hello,

2/ oops.

It seems we are not so many people to daily read the dev forum ; and i’m afraid very few with Live And M4L ; rarely more somebody from cycling74 : so you will have to go with desperate investigations …

for example :

have you tried A_GIMME method instead of A_SYM (in case !?) ?
what is the crash log ?
etc.

#114529
Jul 21, 2012 at 2:51pm

A few things I noticed, you seem to create a DSP object but there’s:
- no dsp64 method, nor perform
- no dsp_free call in your ExternalTest_free

You also call class_register before adding the methods to your object. It should be at the end of the main method.

#114530
Jul 21, 2012 at 3:43pm

Hello Emmanuel,

you are right. My original external uses the dsp functions (perform, dsp_free, etc).
Now I’ve built the same ExternalTest with your advice included. The issue remains the same.

Thanks for your answer!

#include "ext.h"
#include "ext_obex.h"

void *ExternalTest_class;

#define OBJECT_NAME "ExternalTest~"

typedef struct _ExternalTest
{
  t_object x_obj;
} t_ExternalTest;

void *ExternalTest_new(t_symbol *msg, short argc, t_atom *argv);
void ExternalTest_free(t_ExternalTest *x);
void ExternalTest_TestCall(t_ExternalTest *x, t_symbol *SymParam);

void *ExternalTest_class;

void main(void)
{
	t_class *c;
	c = class_new(OBJECT_NAME, (method)ExternalTest_new, (method)ExternalTest_free, (long)sizeof(t_ExternalTest), 0L , A_GIMME, 0);

	class_addmethod(c, (method)ExternalTest_TestCall, "TestCall", A_SYM, 0);

	ExternalTest_class = c;

	class_register(CLASS_BOX, c);

	post("I am the ExternalTest object...");
}

void *ExternalTest_new(t_symbol *msg, short argc, t_atom *argv)
{
  	t_ExternalTest *x = NULL;

	if (x = (t_ExternalTest *)object_alloc(ExternalTest_class))
	{
		object_post((t_object *)x, "a new %s object was instantiated: 0x%X", msg->s_name, x);
	}

  return (x);
}

void ExternalTest_free(t_ExternalTest *x)
{
  ;
}

void ExternalTest_TestCall(t_ExternalTest *x, t_symbol *SymParam)
{
  if(SymParam == NULL)
  {
	object_error((t_object *)x, "TestCall parameter corrupt!");
	return;
  }

  if(SymParam->s_name == NULL)
  {
	object_error((t_object *)x, "TestCall parameter (s_name) corrupt!");
    return;
  }
}
#114531

You must be logged in to reply to this topic.