Web Client Memory error

17 views
Skip to first unread message

Doug Hall

unread,
May 15, 2025, 7:05:24 PM5/15/25
to Active4D
I'm trying to track down a memory leak that keeps happening on my 4D Web Client (v19.8 on Mac), running Active4D. I did notice a lot of timeouts that may have occurred AFTER the web client runs out of memory. This is my emailCount method that's timing out:

<pre>
method "emailCount"($email)
  while(semaphore("emailCount"))
    idle
  end while
  c_longint(webuserEmailCount)
  set query destination(3;webuserEmailCount) // Prevents query from changing the selection.
  query([webuser];[webuser]email;"=";$email)
  set query destination(0) // Allows query to change the selection. (default)
  clear semaphore("emailCount")
  return(webuserEmailCount)
end method
</pre>

I was under the impression from the first example on 4D's documentation of Semaphore that this was safe to do. The semaphore doesn't have a timeout because I'm trying to protect a process variable's value (webuserEmailCount). This seems like it could be a trouble spot. What if the process times out before the semaphore is cleared? Is this even necessary? Since different web users are _supposed_ to be in different processes, do I even need the semaphore to protect the process variable at all?

Secondly, what's the best way to track down memory leaks in Active4D processes?

Thanks,
Doug

David Ringsmuth

unread,
May 15, 2025, 9:48:16 PM5/15/25
to Doug Hall, Active4D
Doug,

In my experience, I had to abandon using 4D Remote as a web server with Active4D.

Mysterious stale locked records, hung web connection processes, crashing...

Same processes on 4D Server/Active4D worked fine.

--
You received this message because you are subscribed to the Google Groups "Active4D" group.
To unsubscribe from this group and stop receiving emails from it, send an email to active4d+u...@googlegroups.com.
Message has been deleted

Doug Hall

unread,
May 16, 2025, 10:06:04 AM5/16/25
to Active4D
I thought Id pass along some other errors I'm seeing in my Active4D logs to Aparajita. They seem more related to him, since they're referring to cpp. I'm using A4D bundle V7.2r1.

<WebClient> » grep "\[error\]" Active4D.0.log
May 16 07:43:20 Active4D: [error] server: illegal character in URL: '{' ({): /Users/aparajita/Developer/projects/4d_plugins/Active4D/src/support/server.cpp, line 2584, checkURL
May 16 07:46:44 Active4D: [error] server: illegal character in URL: '[' ([): /Users/aparajita/Developer/projects/4d_plugins/Active4D/src/support/server.cpp, line 2584, checkURL
May 16 07:46:45 Active4D: [error] server: illegal character in URL: '"' ("): /Users/aparajita/Developer/projects/4d_plugins/Active4D/src/support/server.cpp, line 2584, checkURL
May 16 07:46:46 Active4D: [error] Fusebox core: could not find the circuit you requested: /etc/passwd: /Users/4dserver/Documents/aidtdb/Active4D/fusebox.a4l, method "fusebox.core", line 418
May 16 07:46:46 Active4D: [error] Fusebox core: could not find the circuit you requested: http://www: /Users/4dserver/Documents/aidtdb/Active4D/fusebox.a4l, method "fusebox.core", line 418

Thanks Aparajita!
Doug

Aparajita

unread,
May 16, 2025, 2:03:23 PM5/16/25
to Active4D
Those errors are reported by me, but have nothing to do with me. Look closely at the actual error messages (after "[error]"), they are telling you exactly what the source of the problem is, which in each case is outside of Active4D.

Doug Hall

unread,
May 21, 2025, 10:43:20 AM5/21/25
to Active4D
I've certainly been fighting some of those battles. But my WebClient is taking less and less of a hit, as we have transitioned some services to other software. But, I'm still having to restart my Client every ten days to two weeks or so. Less often, I'll restart my 4D Server (machine and software) as well. I hate that my "go-to" solution could be learned by watching an episode of "The IT Crowd". My problems are memory leaks and potentially related communication drop outs. The two machines are on the same gigabit switch, so unless there's an issue with it, it's really fast. I'd hate to do the work to move it to 4D Server, at this point.

I changed my semaphore to a "local" semaphore, since those methods are all being run on one 4D Web Client. It's possible that the additional workload to protect it at the server level was related to the slowdown. I have other local semaphores in methods that run perfectly, if less frequently. So maybe that will help,  I'll keep track of those errors in my logs.

Doug

Reply all
Reply to author
Forward
0 new messages