Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Aug 20, 2017 11:41 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Stack overflow on Linux, not on Windows for same source
PostPosted: Wed May 22, 2013 5:54 pm 
Offline

Joined: Wed May 15, 2013 6:07 pm
Posts: 13
Hello,

The aim is not to modify the source code so as to save time and effort that would otherwise be required for testing and debugging when such changes are done to accommodate the smaller stack size on Linux compared to Windows.

Quote:
I'm sure that given the opportunity to review your code (essentially under NDA of course) we could figure out whats happening.


Quote:
It could easily be as simple as changing the stack size or something - but right now I'm guessing since I cant debug it to know for sure.


If the kind offer of help above is still outstanding then please see if the sample application in above post dated "Sat May 18, 2013 8:53 pm" can used to find the solution to the stack overflow on Linux which clearly shows that the applicable stack size on Linux is about one fourth the size when compared to Windows for the same RB application.

Thanks and Regards,

Shahid.


Top
 Profile  
Reply with quote  
 Post subject: Re: Stack overflow on Linux, not on Windows for same source
PostPosted: Wed May 22, 2013 8:00 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
Shahid wrote:
Hello,

The aim is not to modify the source code so as to save time and effort that would otherwise be required for testing and debugging when such changes are done to accommodate the smaller stack size on Linux compared to Windows.

Quote:
I'm sure that given the opportunity to review your code (essentially under NDA of course) we could figure out whats happening.


Quote:
It could easily be as simple as changing the stack size or something - but right now I'm guessing since I cant debug it to know for sure.


It's just a suggestion
Often it's not that hard but I dont know your particular case - it could easily be much more complex

Shahid wrote:
If the kind offer of help above is still outstanding then please see if the sample application in above post dated "Sat May 18, 2013 8:53 pm" can used to find the solution to the stack overflow on Linux which clearly shows that the applicable stack size on Linux is about one fourth the size when compared to Windows for the same RB application.

Thanks and Regards,

Shahid.


Really run it in a thread where you can set the stack size
That's THE quickest and on Linux makes the code you gave fail more closely to the Windows & OS X number

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Stack overflow on Linux, not on Windows for same source
PostPosted: Thu May 23, 2013 2:51 pm 
Offline

Joined: Wed May 15, 2013 6:07 pm
Posts: 13
Hello,
Please see the following consolidated details of what has been discussed and done so far for the reported problem.

1. A VB6 application with more than 10 Mbytes of source code has been successfully migrated to RB in May 2013 using “Real Studio 2012r2.1 trial license” on a Windows 7 PC. This application is primarily a ASN.1 Interpreter. This ASN.1 Interpreter is deeply recursive and has been working fine as a VB6 application since 2007. The RB version of this application works fine on Windows without any problems. However the Linux version of the same, built under “Real Studio 2012r2.1 trial license” suffers a stack overflow exception when the call stack is 52 levels deep when decoding the same data that does not cause any crash on the RB Windows version of the same application nor does that cause a crash of VB6 version using the same source code while decoding the same input data. The investigation showed that the point of failure on Linux version of this RB application is a genuine case of stack overflow and there is no fault in the source code.

2. A sample application posted above dated “Sat May 18, 2013 8:53 pm” shows clearly that the stack size available to the RB application on Linux is about one fourth when compared to the stack size in Windows because that sample RB application crashes with stack overflow on Windows after 8402 recursive calls while on Linux it crashed with stack overflow after only 2082 recursive calls.

3. Three separate possible solutions have been suggested in response. These are listed below along with the cause that why these are not feasible.

3.1 The use of threads in this case is not so easy to implement due to the large size of the source code and the time and effort required to modify the code, test and debug the entire application only to accommodate the smaller stack size on Linux. It must be noted here that the thread solution does work for the sample application mentioned above and the Linux version of that sample application can run without stack overflow for more than 8402 recursive calls. However the thread solution is not easy to implement for the actual application in question.

3.2 Use of iteration instead of recursion also presents the same difficulty as described above for the case of thread.

3.3 Use of “setrlimit” through “Soft Declare” has already been proved to be ineffective as shown in the post above dated “Wed May 22, 2013 2:51 pm”, when applied to previously mentioned sample RB application.

4. Some of the fundamental questions still remain unanswered. These are listed below.

4.1 What are the sizes and usage of various stacks that VB6 provides for its applications on Windows?

4.2 What are the sizes and usage of various stacks that RB provides for its applications on Windows?

4.3 What are the sizes and usage of various stacks that RB provides for its applications on Linux?

4.4 What are the sizes and usage of various stacks that RB provides for its applications on MAC OS?

4.5 Who controls these stack sizes? RB, OS, person writing the code, person using the application or others?

4.6 When are these stack sizes set? During the build process under RB? Set by OS and not changeable? And so on.

5. It remains unclear that why the architects of RB at “Real Software” have not ensured that the same stack sizes are available to the RB applications on Windows, Linux and OS when an application is built from the same RB source code. May be there are some restrictions imposed by the Windows, Linux and MAC OS so that RB cannot provide the same stack sizes under these three very distinct OSs. In either case, all such details are expected to have been documented in some reference manual of RB. Does such documentation exist?

Thanks and Regards,

Shahid.


Top
 Profile  
Reply with quote  
 Post subject: Re: Stack overflow on Linux, not on Windows for same source
PostPosted: Thu May 23, 2013 3:59 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
What do you see as the problems in threading your recursive code? Does the code modify the UI? If so, there will be some adjustments needed. Otherwise, it's just a matter of moving the initial call into a thread. The rest of the code can remain where it is, unmodified.


Top
 Profile  
Reply with quote  
 Post subject: Re: Stack overflow on Linux, not on Windows for same source
PostPosted: Thu May 30, 2013 8:06 pm 
Offline

Joined: Wed May 15, 2013 6:07 pm
Posts: 13
Quote:
What do you see as the problems in threading your recursive code? Does the code modify the UI? If so, there will be some adjustments needed.


Hello,
Thank you, I will try the thread option. However the RB design team also need to make the available stack sizes for RB application on Windows, Linux and MAC OS atleast comparable to each other. The sample application (in the post above dated “Sat May 18, 2013 8:53 pm”) clearly shows that the stack size on Linux is about one fouth the stack size on Windows that is available to that RB application.

Do the dialogue boxes or MsgBox called from within a thread qualify as "modification of the UI"? If so then what are the required adjustments please?

Thanks and Regards,

Shahid.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group