RE: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-10 Thread Epperlein, Lutz (agendo) via 4D_Tech
To refer to the original cause of the crash ...
Unfortunately the compiler doesn't find such problems (negative array index 
variable), this is a typical runtime problem. All what you can do is to write 
"defensive" code, e.g. checking the value of an index variable, using error 
handler, don't change the size of an array in a FOR loop whilst accessing of 
array elements using an index variable and so on. 
As others mentioned already ...

Regards Lutz


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-09 Thread Sannyasin Siddhanathaswami via 4D_Tech
Aloha David!

Howzit? By the way, do you go by Sannyasin or Siddhanathaswami? (I've
always seen Sannyasin used as a title/honorific, but I don't know in your
case.)

You are correct. Sannaysin is my title (like “Reverend" I suppose), so 
Siddhanathaswami is better. Either is fine, though, as I doubt there are too 
many Sannyasins on this forum!

Thank you so much for your reply and help understanding a bit more about the 
compiler and how to use it. I suspect I’ll probably do some of my web-testing 
in single user more—this crashing is unacceptable. I suspect adding compiler 
declarations for all the old code we have isn’t going to work out too well. We 
just have too much old, unused or poorly written code! Scares me just thinking 
about it, but some day we will have to do a rewrite of the parts we use all the 
time.

I’ll try the MSC and delete the indexes and see if that changes the crashing.

I’ll also try upgrading from 15.3 to 15.4. Who knows, maybe some bugs related 
to this were fixed.

Thanks again for all the explanations!

Sannyasin Siddhanathaswami


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-09 Thread David Adams via 4D_Tech
>
> On Mon, Apr 10, 2017 at 5:24 AM, Sannyasin Siddhanathaswami via 4D_Tech
> <4d_tech@lists.4d.com> wrote:
> Aloha,

Howzit? By the way, do you go by Sannyasin or Siddhanathaswami? (I've
always seen Sannyasin used as a title/honorific, but I don't know in your
case.)

> Thanks for the tip. Tons and tons of errors in the first run of Check
Syntax
> in the compiler. It is nice that it highlights the line numbers/issues in
an
> open method. The errors though are mostly or all, “The Variable xxx has
not
> been explicitly declared in the typing methods.” As I don't need/want to
> compile,  how do I use this to my advantage? Are you saying I should add
> declarations to the compiler method for all variables?

Yes. Well, all parameters, process, and interprocess variables. Locals need
to be declared in the method. I set my compiler methods up like this:

Compiler_Module

So, for the 'Accounts' module:

Compiler_Accounts

I then have three sections in the method:

Variables
Arrays
Parameters

Why do it like this?

* I can move modules between databases (perhaps of no use to you).
* I always know right where to look.
* It helps me maintain the practice of deciding what module "owns" any bit
of code or data.
* The methods don't usually get too long or unwieldily.

> What I’d really like, is to have only typing errors within a method
> highlighted.
>
> For example, in the method I’m working on, my first lines are:
> C_TEXT($0)
> C_TEXT($1)
>
> This give an error saying these variables are not declare in typing
methods. I
> don’t see how these “errors" highlighted in my code will help with this.

A couple of things come to mind from your post:

* Debugging and reprogramming a live 4D system seems like a super stressful
and risky thing to do to me. What about making a copy of the structure that
you clean up using a single-user development copy?

* $0 and $1 are different than locals. Parameters are subtly different to
locals in a few ways and very different in an important way: they define
how data can go in and out of the method. So, they're not local to the
method - they define the method's interactions. So, it kind of makes sense
to declare them in a Compiler_ method.

* It's not just your imagination: The Compiler_ method system is awkward
and a bit of a pain. It was set up this way in the 1980s and has not
improved since. I see it as a housekeeping nuisance and don't worry about
it too much.

* You're correct: Fixing most of these 'errors' is going to do nothing of
use for you. In a lot of cases, it's just housekeeping with exactly zero
benefit. In other cases, you'll just be making explicit what was working
perfectly implicitly. This task is so daunting now because you've got such
a huge backlog. After that, the process isn't hard. My impression from
people that have shoveled through a pile of errors like yours is that they
were ultimately glad that they did it.

* You _will_ find real bugs. Things like this are subtle:

For ($I;1;$count)
   $value:=$array($l)
End for

As you clear out the nonsense 'errors' and get into the real problems, you
should see some benefits. I always find it humbling to come across
"working" code that has had flaws for years. Even when I've written a bunch
of tests cases, it can still happen. I'm of the school of thought that
thinks writing your own test cases is super likely to lead you to not
thinking of exactly the right cases!

As you get further into it, you'll also probably run into situations
involving multiple methods and shared variables where you have to figure
out what you were thinking (or what someone else was thinking) way back
when. A lot of times, you'll come up with a way of solving the same problem
much more neatly. That always feels good. Of course, be careful about this
sort of work. It's risky just "improving" things. Make notes about what you
find, even if you don't "fix" it. There is a lot of wisdom in the old
phrase "If it ain't broke, don't fix it." Still, the temptation will be
there...

>  Right now it’s crashing on Distinct Values, which I suspect means there
are not
> “distinct” values in the selection.

Have you tested the data file with MSC? Have you tried rebuilding indexes?
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-09 Thread Sannyasin Siddhanathaswami via 4D_Tech
Aloha,

Thanks for the tip. Tons and tons of errors in the first run of Check Syntax in 
the compiler. It is nice that it highlights the line numbers/issues in an open 
method. The errors though are mostly or all, “The Variable xxx has not been 
explicitly declared in the typing methods.” As I don't need/want to compile,  
how do I use this to my advantage? Are you saying I should add declarations to 
the compiler method for all variables?

What I’d really like, is to have only typing errors within a method highlighted.

For example, in the method I’m working on, my first lines are:
C_TEXT($0)
C_TEXT($1)

This give an error saying these variables are not declare in typing methods. I 
don’t see how these “errors" highlighted in my code will help with this.

The On Err Call, is helping with crashes, but if I do a TRACE (even with the On 
Err Call active), it still crashes when I get to the bad code line. I’ll play 
with the webserver on the client to see if I can work around that. Right now 
it’s crashing on Distinct Values, which I suspect means there are not 
“distinct” values in the selection. I’m a bit shocked how sensitive the Web 
Server is!



Sannyasin Siddhanathaswami

On Apr 7, 2017, 9:20 AM -1000, Timothy Penner via 4D_Tech 
<4d_tech@lists.4d.com>, wrote:
Aloha Sannyasin,

I probably sound like a broken record talking about the compiler so much, but I 
really wanted to comment on this:

As this is an internal database for our non-profits, it’s run in interpreted 
mode, so no compiler checking done.
I do a decent amount of the programing (for the past 10-years), and use what I 
program.

The compiler is a great tool for catching coding mistakes; regardless of 
whether you plan to deploy compiled or interpreted: 
http://kb.4d.com/assetid=50223
"If after fixing your code you do not want to run your application compiled, 
simply click on the *"Clear Compiled Code"* button to remove the compiled code."

I don’t think I can use the compiler to do checking either, as tons of the code 
is carried forward
from v1 and v2, and lots of code written without compiler declarations.

This shouldn't prevent you from using the compiler; as long as you have either 
Developer Pro (singleuser) or Team Developer (client-server) the compiler 
should work for you - it doesn't matter how old the code is, the compiler 
should still function. If you don’t have Developer Pro or Team Developer then I 
think that the "Check Syntax" option should still work, even if the compile 
button is greyed out.

Aloha,

-Tim


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-07 Thread Timothy Penner via 4D_Tech
Aloha Sannyasin,

I probably sound like a broken record talking about the compiler so much, but I 
really wanted to comment on this:

> As this is an internal database for our non-profits, it’s run in interpreted 
> mode, so no compiler checking done.
> I do a decent amount of the programing (for the past 10-years), and use what 
> I program.

The compiler is a great tool for catching coding mistakes; regardless of 
whether you plan to deploy compiled or interpreted: 
http://kb.4d.com/assetid=50223
"If after fixing your code you do not want to run your application compiled, 
simply click on the *"Clear Compiled Code"* button to remove the compiled code."

> I don’t think I can use the compiler to do checking either, as tons of the 
> code is carried forward
>  from v1 and v2, and lots of code written without compiler declarations.

This shouldn't prevent you from using the compiler; as long as you have either 
Developer Pro (singleuser) or Team Developer (client-server) the compiler 
should work for you - it doesn't matter how old the code is, the compiler 
should still function. If you don’t have Developer Pro or Team Developer then I 
think that the "Check Syntax" option should still work, even if the compile 
button is greyed out.

Aloha,

-Tim




**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-07 Thread Sannyasin Siddhanathaswami via 4D_Tech
Thanks! I’ll be using both of those tips. I haven’t used On Error Call much, 
but will look into it. At a minimum, I want: “On Error, don’t crash my server!"

Sannyasin Siddhanathaswami

On Apr 7, 2017, 9:12 AM -1000, wrote:

Sannyasin,
Two things:
I make it a habit to check for -1 anywhere I'm using Find in array... it
just bites me if I don't.

For methods that run on the server, or even better for processes that run
on the server, wrap them in an On err call method that lets you manage the
errors yourself. Like not stopping for them. Log them or abort the process.
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-07 Thread Kirk Brooks via 4D_Tech
Sannyasin,
Two things:
I make it a habit to check for -1 anywhere I'm using Find in array... it
just bites me if I don't.

For methods that run on the server, or even better for processes that run
on the server, wrap them in an On err call method that lets you manage the
errors yourself. Like not stopping for them. Log them or abort the process.

On Fri, Apr 7, 2017 at 11:51 AM, Sannyasin Siddhanathaswami via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Aloha,
>
> Yes. The crash did happen when accessing an array with a negative index!
> If that’s the only thing that causes the crash, I can be extra careful
> about that and do checks. Thanks for pointing this out. And yes, I wrote
> that serious bug. :)
>
> As this is an internal database for our non-profits, it’s run in
> interpreted mode, so no compiler checking done. I do a decent amount of the
> programing (for the past 10-years), and use what I program.
>
> I don’t think I can use the compiler to do checking either, as tons of the
> code is carried forward from v1 and v2, and lots of code written without
> compiler declarations.
>

-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-07 Thread Sannyasin Siddhanathaswami via 4D_Tech
Aloha,

Yes. The crash did happen when accessing an array with a negative index! If 
that’s the only thing that causes the crash, I can be extra careful about that 
and do checks. Thanks for pointing this out. And yes, I wrote that serious bug. 
:)

As this is an internal database for our non-profits, it’s run in interpreted 
mode, so no compiler checking done. I do a decent amount of the programing (for 
the past 10-years), and use what I program.

I don’t think I can use the compiler to do checking either, as tons of the code 
is carried forward from v1 and v2, and lots of code written without compiler 
declarations.


Sannyasin Siddhanathaswami

On Apr 6, 2017, 11:15 PM -1000, wrote:

To be honest, I don't understand these problems. Our main product relies 
heavily on the 4D webserver on the server, for years. So far there aren't any 
serious problems. If there are any, we wouldn't use 4D anymore.
And running the webserver on a client isn't an option for us.

The only problem we experienced which causes a server crash is accessing an 
array with a negative index. But such things are caused by serious bugs (during 
development).
What compiler settings do you use?

Regards
Lutz
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-07 Thread npdennis via 4D_Tech
> What compiler settings do you use? 

Do you have the range checking ON (top option in the compiler settings)? If not 
you should.


--
Neil Dennis
4D Developer since 1990


GreaText - Designing Software for the Way You Work
716 East 1850 N
North Ogden, UT 84414

mailto:npden...@greatext.com
http://www.greatext.com/



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-07 Thread Epperlein, Lutz (agendo) via 4D_Tech
To be honest, I don't understand these problems. Our main product relies 
heavily on the 4D webserver on the server, for years. So far there aren't any 
serious problems. If there are any, we wouldn't use 4D anymore.
And running the webserver on a client isn't an option for us.

The only problem we experienced which causes a server crash is accessing an 
array with a negative index. But such things are caused by serious bugs (during 
development).
What compiler settings do you use? 

Regards
Lutz

> -Original Message-
> From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Joshua Hunter
> via 4D_Tech
> Sent: Thursday, April 6, 2017 11:56 PM
> To: 4D iNug Technical <4d_tech@lists.4d.com>
> Cc: Joshua Hunter 
> Subject: RE: 4D Server Crashes When Tracing Buggy Web Connection Code
> 
> The web server process is very sensitive to any bugs. We ran into the exact 
> problem
> you are having. Our web team was suddenly very unpopular with the other
> developers. Any bug and the whole app would crash.
> 
> We no longer run any code on the web server process on 4D server. Instead we 
> run a
> client application that acts as a web server. This works pretty well.
> 
> The code that gets traced is the code on the machine that handled the 
> request. So if
> you make the request to your web server client application it will trace 
> there. The web
> server on client can run on the same physical server as your 4D server so 
> long as
> they aren't both handling requests on the same port.
> 
> The biggest hurdle we had was getting the correct 4D licensing. There was a 
> special
> license to make the client run the web server. This may be made more difficult
> because we are an OEM.
> 
> Joshua Hunter
> jos...@dwdev.com
> (425)673-1974
> www.dwdev.com
> Dataworks Development, Inc.
> Providing secure and configurable data management solutions for research and 
> clinical
> labs since 1987.
> 
> 
> -Original Message-
> From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Sannyasin
> Siddhanathaswami via 4D_Tech
> Sent: Thursday, April 6, 2017 2:14 PM
> To: 4D iNug Tech
> Cc: Sannyasin Siddhanathaswami
> Subject: 4D Server Crashes When Tracing Buggy Web Connection Code
> 
> Aloha,
> 
> If I trace On Web Connection code on 4D Server v15.3 Mac, and I goof and 
> reference
> an out of index array (I know I’m the first to ever do that), our server 
> crashes. It just
> quits to the Finder, no error message nothing. I view the trace via screen 
> sharing to
> the server machine.
> 
> This is disastrous when other people are using 4D!!
> 
> Have others run into this? What’s the best way to debug On Web Connection code
> without crashing the server?
> 
> Maybe starting the webserver on 4D client? But how does adding a “Trace" On 
> Web
> Connection code work? Won’t it still trace on the 4D Server?
> 
> Sannyasin Siddhanathaswami
> *
> *
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> *
> *
> *
> *
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> *
> *
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: 4D Server Crashes When Tracing Buggy Web Connection Code

2017-04-06 Thread Joshua Hunter via 4D_Tech
The web server process is very sensitive to any bugs. We ran into the exact 
problem you are having. Our web team was suddenly very unpopular with the other 
developers. Any bug and the whole app would crash.

We no longer run any code on the web server process on 4D server. Instead we 
run a client application that acts as a web server. This works pretty well.

The code that gets traced is the code on the machine that handled the request. 
So if you make the request to your web server client application it will trace 
there. The web server on client can run on the same physical server as your 4D 
server so long as they aren't both handling requests on the same port.

The biggest hurdle we had was getting the correct 4D licensing. There was a 
special license to make the client run the web server. This may be made more 
difficult because we are an OEM.

Joshua Hunter
jos...@dwdev.com
(425)673-1974
www.dwdev.com
Dataworks Development, Inc.
Providing secure and configurable data management solutions for research and 
clinical labs since 1987.


-Original Message-
From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Sannyasin 
Siddhanathaswami via 4D_Tech
Sent: Thursday, April 6, 2017 2:14 PM
To: 4D iNug Tech
Cc: Sannyasin Siddhanathaswami
Subject: 4D Server Crashes When Tracing Buggy Web Connection Code

Aloha,

If I trace On Web Connection code on 4D Server v15.3 Mac, and I goof and 
reference an out of index array (I know I’m the first to ever do that), our 
server crashes. It just quits to the Finder, no error message nothing. I view 
the trace via screen sharing to the server machine.

This is disastrous when other people are using 4D!!

Have others run into this? What’s the best way to debug On Web Connection code 
without crashing the server?

Maybe starting the webserver on 4D client? But how does adding a “Trace" On Web 
Connection code work? Won’t it still trace on the 4D Server?

Sannyasin Siddhanathaswami
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**