Thread: Debug works, Release not

Debug works, Release not

From
Jasmin Dizdarevic
Date:
Hi, 

have you ever had the problem, that a Debug build works on windows and the Release does not?
The problem is an access violation during appending items to a combobox.

I tried to disable optimization, without success.
It's difficult to provide a patch now, because the changes are not small. Here is the problem line. I've also tried to remove "if(connection->pgAgentMinimumVersion(4))". 
I've included the upper section (pga_jobclass) to demonstrate the similarity of the code - this works well!

I've added the cbEmailNotType-Combobox to the xrc file and also a pointer to it. Have I forgotten something important, that is required for a successful release?


File: dlgJob.cpp

#define cbEmailNotType CTRL_COMBOBOX("cbEmailNotType") 
....

    pgSet *jcl=connection->ExecuteSet(wxT("SELECT jclname FROM pgagent.pga_jobclass"));
    if (jcl)
    {
        while (!jcl->Eof())
        {
            cbJobclass->Append(jcl->GetVal(0));
            jcl->MoveNext();
        }
        delete jcl;
    }
if(connection->pgAgentMinimumSchemaVersion(4)) 
{
pgSet *mnk = connection->ExecuteSet(wxT("SELECT jmntypename FROM pgagent.pga_jobmailnottype"));
if(mnk) 
{
while(!mnk->Eof()) 
{
cbEmailNotType->Append(mnk->GetVal(0));
mnk->MoveNext();
}
delete mnk;
}

}

If there is not an obvious reason, I will send a complete patch until weekend.

Regards,
Jasmin

Re: Debug works, Release not

From
Dave Page
Date:
On Wed, Jan 5, 2011 at 11:09 AM, Jasmin Dizdarevic
<jasmin.dizdarevic@gmail.com> wrote:
> Hi,
> have you ever had the problem, that a Debug build works on windows and the
> Release does not?
> The problem is an access violation during appending items to a combobox.
> I tried to disable optimization, without success.
> It's difficult to provide a patch now, because the changes are not small.
> Here is the problem line. I've also tried to remove
> "if(connection->pgAgentMinimumVersion(4))".
> I've included the upper section (pga_jobclass) to demonstrate the similarity
> of the code - this works well!
> I've added the cbEmailNotType-Combobox to the xrc file and also a pointer to
> it. Have I forgotten something important, that is required for
> a successful release?

I don't see any obvious issues, but have you tried a complete clean
and rebuild? That can solve a host of weird problems...


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Debug works, Release not

From
Jasmin Dizdarevic
Date:
Yes, I have. Maybe the problem is VS 2010, however it's very strange.

2011/1/5 Dave Page <dpage@pgadmin.org>
On Wed, Jan 5, 2011 at 11:09 AM, Jasmin Dizdarevic
<jasmin.dizdarevic@gmail.com> wrote:
> Hi,
> have you ever had the problem, that a Debug build works on windows and the
> Release does not?
> The problem is an access violation during appending items to a combobox.
> I tried to disable optimization, without success.
> It's difficult to provide a patch now, because the changes are not small.
> Here is the problem line. I've also tried to remove
> "if(connection->pgAgentMinimumVersion(4))".
> I've included the upper section (pga_jobclass) to demonstrate the similarity
> of the code - this works well!
> I've added the cbEmailNotType-Combobox to the xrc file and also a pointer to
> it. Have I forgotten something important, that is required for
> a successful release?

I don't see any obvious issues, but have you tried a complete clean
and rebuild? That can solve a host of weird problems...


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Debug works, Release not

From
Magnus Hagander
Date:
Not sure if I've seen it with pgadmin, but could it be that the debug
build initializes memory to zero whereas the release build may leave
it at random, which means it could be a simple
string-with-no-terminating-NULL thing?

//Magnus

On Wed, Jan 5, 2011 at 12:23, Jasmin Dizdarevic
<jasmin.dizdarevic@gmail.com> wrote:
> Yes, I have. Maybe the problem is VS 2010, however it's very strange.
>
> 2011/1/5 Dave Page <dpage@pgadmin.org>
>>
>> On Wed, Jan 5, 2011 at 11:09 AM, Jasmin Dizdarevic
>> <jasmin.dizdarevic@gmail.com> wrote:
>> > Hi,
>> > have you ever had the problem, that a Debug build works on windows and
>> > the
>> > Release does not?
>> > The problem is an access violation during appending items to a combobox.
>> > I tried to disable optimization, without success.
>> > It's difficult to provide a patch now, because the changes are not
>> > small.
>> > Here is the problem line. I've also tried to remove
>> > "if(connection->pgAgentMinimumVersion(4))".
>> > I've included the upper section (pga_jobclass) to demonstrate the
>> > similarity
>> > of the code - this works well!
>> > I've added the cbEmailNotType-Combobox to the xrc file and also a
>> > pointer to
>> > it. Have I forgotten something important, that is required for
>> > a successful release?
>>
>> I don't see any obvious issues, but have you tried a complete clean
>> and rebuild? That can solve a host of weird problems...
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Re: Debug works, Release not

From
Jasmin Dizdarevic
Date:
This could be an issue, but the problem occurs at the pointer to the combobox. If I debug it (in Release) I'm getting the exception when trying to step in AppendItem-Method. Step-In into GetVal works. 
I will provide a patch asap, so someone of you guys can try to build it. Maybe it's because of my environment.

Regards

2011/1/5 Magnus Hagander <magnus@hagander.net>
Not sure if I've seen it with pgadmin, but could it be that the debug
build initializes memory to zero whereas the release build may leave
it at random, which means it could be a simple
string-with-no-terminating-NULL thing?

//Magnus

On Wed, Jan 5, 2011 at 12:23, Jasmin Dizdarevic
<jasmin.dizdarevic@gmail.com> wrote:
> Yes, I have. Maybe the problem is VS 2010, however it's very strange.
>
> 2011/1/5 Dave Page <dpage@pgadmin.org>
>>
>> On Wed, Jan 5, 2011 at 11:09 AM, Jasmin Dizdarevic
>> <jasmin.dizdarevic@gmail.com> wrote:
>> > Hi,
>> > have you ever had the problem, that a Debug build works on windows and
>> > the
>> > Release does not?
>> > The problem is an access violation during appending items to a combobox.
>> > I tried to disable optimization, without success.
>> > It's difficult to provide a patch now, because the changes are not
>> > small.
>> > Here is the problem line. I've also tried to remove
>> > "if(connection->pgAgentMinimumVersion(4))".
>> > I've included the upper section (pga_jobclass) to demonstrate the
>> > similarity
>> > of the code - this works well!
>> > I've added the cbEmailNotType-Combobox to the xrc file and also a
>> > pointer to
>> > it. Have I forgotten something important, that is required for
>> > a successful release?
>>
>> I don't see any obvious issues, but have you tried a complete clean
>> and rebuild? That can solve a host of weird problems...
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Re: Debug works, Release not

From
Jasmin Dizdarevic
Date:
Hi, 

here is the patch, that enables UI for pgAgent 4.
It would be great if somebody could try to build in Release mode. 
The UI should work with pgAgent schema version 3 - if not, please tell me. Please tell me also, if I have violated coding policies or something else.

To test the new features, you can apply attached pgagent_upgrade.sql. 

Thanks & Regards,
Jasmin

2011/1/5 Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>
This could be an issue, but the problem occurs at the pointer to the combobox. If I debug it (in Release) I'm getting the exception when trying to step in AppendItem-Method. Step-In into GetVal works. 
I will provide a patch asap, so someone of you guys can try to build it. Maybe it's because of my environment.

Regards

2011/1/5 Magnus Hagander <magnus@hagander.net>

Not sure if I've seen it with pgadmin, but could it be that the debug
build initializes memory to zero whereas the release build may leave
it at random, which means it could be a simple
string-with-no-terminating-NULL thing?

//Magnus

On Wed, Jan 5, 2011 at 12:23, Jasmin Dizdarevic
<jasmin.dizdarevic@gmail.com> wrote:
> Yes, I have. Maybe the problem is VS 2010, however it's very strange.
>
> 2011/1/5 Dave Page <dpage@pgadmin.org>
>>
>> On Wed, Jan 5, 2011 at 11:09 AM, Jasmin Dizdarevic
>> <jasmin.dizdarevic@gmail.com> wrote:
>> > Hi,
>> > have you ever had the problem, that a Debug build works on windows and
>> > the
>> > Release does not?
>> > The problem is an access violation during appending items to a combobox.
>> > I tried to disable optimization, without success.
>> > It's difficult to provide a patch now, because the changes are not
>> > small.
>> > Here is the problem line. I've also tried to remove
>> > "if(connection->pgAgentMinimumVersion(4))".
>> > I've included the upper section (pga_jobclass) to demonstrate the
>> > similarity
>> > of the code - this works well!
>> > I've added the cbEmailNotType-Combobox to the xrc file and also a
>> > pointer to
>> > it. Have I forgotten something important, that is required for
>> > a successful release?
>>
>> I don't see any obvious issues, but have you tried a complete clean
>> and rebuild? That can solve a host of weird problems...
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Attachment

[SOLVED] Fwd: Debug works, Release not

From
Jasmin Dizdarevic
Date:
Nobody said me, that Release uses compiled .xrc-Files and Debug doesn't? :p

embed-xrc.bat was the solution.

Jasmin

---------- Forwarded message ----------
From: Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>
Date: 2011/1/6
Subject: Re: [pgadmin-hackers] Debug works, Release not
To: pgadmin-hackers@postgresql.org


Hi, 

here is the patch, that enables UI for pgAgent 4.
It would be great if somebody could try to build in Release mode. 
The UI should work with pgAgent schema version 3 - if not, please tell me. Please tell me also, if I have violated coding policies or something else.

To test the new features, you can apply attached pgagent_upgrade.sql. 

Thanks & Regards,
Jasmin

2011/1/5 Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>

This could be an issue, but the problem occurs at the pointer to the combobox. If I debug it (in Release) I'm getting the exception when trying to step in AppendItem-Method. Step-In into GetVal works. 
I will provide a patch asap, so someone of you guys can try to build it. Maybe it's because of my environment.

Regards

2011/1/5 Magnus Hagander <magnus@hagander.net>

Not sure if I've seen it with pgadmin, but could it be that the debug
build initializes memory to zero whereas the release build may leave
it at random, which means it could be a simple
string-with-no-terminating-NULL thing?

//Magnus

On Wed, Jan 5, 2011 at 12:23, Jasmin Dizdarevic
<jasmin.dizdarevic@gmail.com> wrote:
> Yes, I have. Maybe the problem is VS 2010, however it's very strange.
>
> 2011/1/5 Dave Page <dpage@pgadmin.org>
>>
>> On Wed, Jan 5, 2011 at 11:09 AM, Jasmin Dizdarevic
>> <jasmin.dizdarevic@gmail.com> wrote:
>> > Hi,
>> > have you ever had the problem, that a Debug build works on windows and
>> > the
>> > Release does not?
>> > The problem is an access violation during appending items to a combobox.
>> > I tried to disable optimization, without success.
>> > It's difficult to provide a patch now, because the changes are not
>> > small.
>> > Here is the problem line. I've also tried to remove
>> > "if(connection->pgAgentMinimumVersion(4))".
>> > I've included the upper section (pga_jobclass) to demonstrate the
>> > similarity
>> > of the code - this works well!
>> > I've added the cbEmailNotType-Combobox to the xrc file and also a
>> > pointer to
>> > it. Have I forgotten something important, that is required for
>> > a successful release?
>>
>> I don't see any obvious issues, but have you tried a complete clean
>> and rebuild? That can solve a host of weird problems...
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/



Re: [SOLVED] Fwd: Debug works, Release not

From
Dave Page
Date:
On Fri, Jan 7, 2011 at 2:00 AM, Jasmin Dizdarevic
<jasmin.dizdarevic@gmail.com> wrote:
> Nobody said me, that Release uses compiled .xrc-Files and Debug doesn't? :p
> embed-xrc.bat was the solution.

Oh - yeah. Don't forget to run embed-xrc. That'll cause strange
crashes in release builds :-p

Sorry :-)

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Debug works, Release not

From
Dave Page
Date:
On Thu, Jan 6, 2011 at 7:30 PM, Jasmin Dizdarevic
<jasmin.dizdarevic@gmail.com> wrote:
> Hi,
> here is the patch, that enables UI for pgAgent 4.

Cool!

> It would be great if somebody could try to build in Release mode.
> The UI should work with pgAgent schema version 3 - if not, please tell me.

It doesn't. See the attached screenshot for the error seen upon
connection. Further errors when checking opening the new job dialogue,
then a crash. It shouldn't take much effort to figure out I imagine
:-)

> Please tell me also, if I have violated coding policies or something else.

Actually, it looks pretty clean to me. A good first-ever patch, style
wise and architecturally.

> To test the new features, you can apply attached pgagent_upgrade.sql.

You're missing a ; in there on line 19, and have terminated lines 27 -
29 with , instead of ;.

Fixing that, and I can see the new UI without any errors, however, I
cannot test it without an agent. Actually, that's pretty annoying -
currently I can configure my jobs before I setup my agent, but with
this change, I can no longer do that, because the agents need to have
registered their email capability in the database already. I'm not
sure that's behaviour that is desirable... but it becomes irrelevant
if we fully integrate the SMTP code as discussed.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment

Re: Debug works, Release not

From
Jasmin Dizdarevic
Date:


2011/1/7 Dave Page <dpage@pgadmin.org>
On Thu, Jan 6, 2011 at 7:30 PM, Jasmin Dizdarevic
> here is the patch, that enables UI for pgAgent 4.

Cool!

> It would be great if somebody could try to build in Release mode.
> The UI should work with pgAgent schema version 3 - if not, please tell me.

It doesn't. See the attached screenshot for the error seen upon
connection. Further errors when checking opening the new job dialogue,
then a crash. It shouldn't take much effort to figure out I imagine
:-)

Great that you've tested it on Mac OS. I've used an uninitialized int-variable that doesn't behaves like on windows. that's the reason for the error's. It's already fixed.
 
> Please tell me also, if I have violated coding policies or something else.

Actually, it looks pretty clean to me. A good first-ever patch, style
wise and architecturally.

Thanks, pgAdmin's architecture is clean and it's pretty easy to start with it. 
 
> To test the new features, you can apply attached pgagent_upgrade.sql.

You're missing a ; in there on line 19, and have terminated lines 27 -
29 with , instead of ;.

OK.
 
Fixing that, and I can see the new UI without any errors, however, I
cannot test it without an agent. Actually, that's pretty annoying -
currently I can configure my jobs before I setup my agent, but with
this change, I can no longer do that, because the agents need to have
registered their email capability in the database already. I'm not
sure that's behaviour that is desirable... but it becomes irrelevant
if we fully integrate the SMTP code as discussed.

I'm still waiting for the authorization :(

Regards
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company