-
Content Count
93 -
Joined
-
Last visited
-
Days Won
2
Posts posted by Berocoder
-
-
5 minutes ago, Die Holländer said:Is it always on specific SQL statements/queries, like the Select you showed?
You can try not to lock those Selects by: 'select * from "myTable" where ..... with(NOLOCK)';
Just to see if the locking READ COMMITTED is the problem.
See if the database drivers your users using are still the same.
I have actually tested READ_COMMITTED in SQL Studio by open 2 tabs.
One with update query with no commit.
And the other with read query for same data.
And read query is waiting until I commit on first tab.
So that is how READ_COMMITTED works.
But I also think that update should not take long time.
Obviously it is more complicated than that.
Had meeting today and we looked at slow queries from Google admin console.
Most was select queries but there was also some updates.
Single slowest update for one row was 16 seconds.
So this feels weird. It should be done in milliseconds.
I suppose it waiting on something else so it is a chain reaction.
We also saw that some logs was missing 30.4 the day problem started.
Might be that the problem starts in Google.
We have made a support ticket to them.
But much more questions than answers now. -
2 hours ago, PeaShooter_OMO said:@Berocoder
Does your SQL Servers update automatically through Windows Updates or some other mechanism? Was there any other Windows Updates that took place?
What does the Performance monitoring on those machines/VMs (client and server) tell you about the current state of the machine when this issue appears or when you run those slow queries?The OS behind SQL Server is handled by Google. None of us have access to it. We see only MSSQL Instance.
On applications server was latest updates 10 April so before this problem starts. -
Our team have a big problem now but I don't expect people here have the complete solution. Maybe I get a hint.
Background
I work in a team with for developers. We maintain a big ERP desktop program for transport logistics. Size is about 9 MLOC but that include Devexpress grid and components.
The company have about 200 active users. What is a bit unusual is that we use Bold for Delphi as framework between database and application code.
That means 99% of SQL for read and 100 % of write queries are generated by Bold.
Application is deployed on GCP (Google Computing Platform).
The code is far from perfect, there is for example random exceptions in a dialog that handle ferries...
We made a patch 29 April morning. People worked normal on that day.
Next day 30 April we got reports on slow performance.
Slow SQL queries are logged. So I checked that
24 - 29 April there was about 80-90 queries per day that took more than 15 seconds.
30 April and forward there was 200-400 queries per day.
There is a slight increases of deadlocks. Now 30 - 40 per day. Previosly it was 15 - 25.
I don't get it. Previous patch was made 11 April.
Commits in git after patch was not so complicated.
A new column was added to a table that replaced a calculated value for vehicles driver.
And reads of that was also significantly faster.
And also some other minor changes.
Anyway if the patch is the reason 29 April should also been a slow day. It wasn't.
This is a sample slow query. PlanMission table represent a Trip for vehicle. But each vehicle unit have own insteance.
So for example if a truck combination consists of a hauler and a trailer that is 2 PlanMissions.
The PlanMission.Trailer link is connected in that case.
The purpose of query is to have one row per combination. Trailers are excluded.
2025-05-06 10:13:05:801 (21820) PERF: TBoldUniDACQuery.Open took 58.803 seconds (0.000s cpu) 1 sql forSELECT PlanMission.bold_id FROM PlanMission WHERE (statePlanOpen > 0 OR stateInProcess > 0) AND PlanMission.bold_id NOT IN (SELECT Trailer FROM PlanMission)
It took almost a minute to execute. Result is around 1000 rows.
One thing I thought about is that we have always used READ_COMMITED isolation in MS SQL Server database.
I am no DB guru but that means if any row in the result is updating but not committed queries like above have to wait until done.
Advantage is that read query got the latest data.
Disadvantage is that user have to wait for the result.
But write queries should be fast so don't know either....
If I run query above it takes 0 seconds but that might use the cache in database so maybe not fair comparison.
Other things to mention. There is a big project to improve logging but it is not in production yet.
Unfortunately that would be handy now.
Currently the log is written to a text-file. One per user and session.
In the future all logs will be sent to a LogManager application that save it in a logdatabase instead.
This will make it easier to analyze problems where different users read and write same data.
That is also a problem we had in the past. A group of users both read and modify vehicle-trips and parcels.
This is slow. But currently much slower than normal.
Can only guess of the reason. It can be the patch. Or it can be some other external issue that came now.
As I said I don't expect a solution but maybe a discussion that generate ideas 🙂 -
The code I wrote was just an example. Actually the project don't have much code to handle raw SQL. We have a framework for that. It is also very big project. About 9 MLOC when do a full build.
So the goal is always to do as much as possible in the global exception handler. I cannot evaluate all methods if there is a chance for exception or not. There are many thousands of them.
But in some cases there is a need to add more information to the exception message to make it easier to find the reason for exception and fix it later.
This is the main reason to do try/except in code -
Thanks for the code. I work on rather big application with centralized handling of exceptions.
So in most cases try/except is not used.
But there is also many places where we want a more customized behaviour.
Like add more information to the exceptionmessage.
Callstack is generated with JCL. But we have also tried EurekaLog.
It is VERY important that the linenumber of original exception is not lost when log callstack.
So that is why I am suspicious at ChatGpts suggestion. It also look more complicated that just modify the Errormessage.
But it would be nice to find a more complete demo of how RaiseOuterException is used and how global exceptionHandler can traverse inner exceptions.
https://docwiki.embarcadero.com/Libraries/Athens/en/System.SysUtils.Exception.RaiseOuterException don't have much information.
Another thing. Raise Exceptions is slow. So raise one Exception and then raise again should be twice as slow ? -
Today I had a debate with ChatGPT how to handle Exceptions in Delphi 🙂
First it try to talk about Java but I remind that now I am using Delphi...
I don't post the whole conversation as it is boring to read.My convention is to do something like this:
try sqhpartyroles.sql := fsqlhandle.buildsql; sqhpartyroles.executesql; except on e: exception do begin e.message := format('error %s from sql %s', [e.message, sqhpartyroles.sql]); raise; end; end;
If an exception happen I catch it in a global exceptionhandler to log callstack and exceptions message.
In this case I also want to add some more information in the message.
Reply of ChatGPT:
In your scenario, you are indeed preserving the original error message. However, modifying the message of an already thrown exception is generally considered a bad practice, for a few reasons:1. Reusability and encapsulation: If some other part of the code also catches and handles the same exception, it might receive an error message that has been modified somewhere else in the code, which can be quite confusing.
2. Concurrency issues: In a multithreaded environment, exception objects might be shared among multiple threads. If one thread modifies an exception message, it affects all the other threads that might be handling the same exception.
3. Traceability: By altering the exception message, you lose line numbers and other stack trace information that can help locate where the exception initially occurred.
Instead of modifying the original exception, you can create and throw a new exception, adding your custom message while retaining the precious stack trace of the original exception.
In Delphi, the way to do this would be to raise a new exception and pass the original exception as an inner exception:
try sqhpartyroles.sql := fsqlhandle.buildsql; sqhpartyroles.executesql; except on e: exception do begin raise Exception.CreateFmt('error %s from sql %s', [e.message, sqhpartyroles.sql]).SetInnerException(e); end; end;
In this way you have a new exception with the additional context (the SQL that caused the problem), but you also keep the original exception with all its crucial debugging details. However, please note that `SetInnerException` is not a standard Delphi RTL method. To use it, you need to extend the `Exception` class and add it by yourself:
type TMyException = class(Exception) private FInnerException: Exception; public function SetInnerException(e: Exception): TMyException; property InnerException: Exception read FInnerException; end; function TMyException.SetInnerException(e: Exception): TMyException; begin FInnerException := e; Result := Self; end;
I have seen some references to InnerException but never used it.
What is your best practice for exceptions ? -
I have been implemented send email with FNC CloudPack to OutLook in Azure. Technically everything works fine.
But now there is a change request to automate login.
First time a user send an email the browser is started and user need to login.
I want to remove that step.
I found XOAuth2 protocol that seems to be an extension to OAuth2 that can do this automation by periodically refresh the token ?- Is this possible with FNC CloudPack.
- I found TMS Sphinx. is it possible with this one ?
- Found this XOAUTH2 Demo from another Component supplier
- Any other way forward ?
I am using Delphi 11.3
-
4 minutes ago, Michaell said:No more C++ Builder crashes at debugging.
But this was about Delphi
-
On 11/18/2024 at 10:51 AM, Michaell said:Solution at my system, modify via regedit:
HKEY_CURRENT_USER\Software\Embarcadero\BDS\23.0\Debugging\HighlightDebugWindows
from True to False
What is changed when I do this ?
-
Yes it is a good idea! But I cannot make any promises. Time is limited
-
1
-
-
Problem solved. It was my mistake.
ApplicationEvents.OnException := nil;
I believed that this disabled old JCL that was used before. But it seems to disable whole exception mechanism for software exceptions.
Hardware exceptions still works. -
1 minute ago, Kas Ob. said:Can you confirm the assertion code is there ? (i mean the compiler did add the code )
I ran of something similar but it was the IDE fault, sometimes disabling the assertion in project options, and then re-enabling them is not enough for some reason the compiler will not add them until calling clean on the project or closing the project and re-open it, this happen on XE8.
In all cases put a break point and see if the assert code in assembly is there, also it could be a forgotten directive somewhere.
The actual Assert is triggered and catched by Delphi IDE.
It is just that it is not catched by EurekaLog.
So there is no EL-logfile and my event OnExceptionNotify is not called -
From SO https://stackoverflow.com/questions/79332724/assert-raise-no-exception
It feels like I tried everything.Asserts logs fine with a new application but not in the real big application.
Any hints what to do ?
-
16 hours ago, Cristian Peța said:EurekaLog can send data to a bug tracker. See https://www.eurekalog.com/help/eurekalog/index.php?bug_trackers_setup.php
We use MadExcept and data are sent to Mantis that uses MySQL (actually MariaDB). An SQL server can handle a huge amount of data.
Let EurekaLog send all exceptions to a database is not an bad idea. The downside is that unlike a textfile it needs a tool to red it. Or a SQL prompt...
But we have already a system with log-files that contains various loggings, exceptions and callstacks.
This use one log-file per running process.
We are also working on a solution to log everything to one central place in Google Cloud Platform.
So that might be the final solution 😊 -
13 hours ago, Anders Melander said:It sounds to me like you have a quality problem if you have that many exceptions.
In the applications that I work on (users in the hundreds), every single exception that are caught by the outer exception handler (madExcept in our case) is treated as a must-fix bug. On the average I would say we get one or two a month if we've been sloppy with the QA.
The madExcept bug reports are usually either mailed to us by the madExcept UI, or retrieved from the customer's system by our supporters, and attached to a JIRA issue. It is extremely rare that we need to compare call stacks to detect a duplicate. AFAIK madExcept can do so automatically via a hash or something but we've never used that feature.
So the only advice I can offer is: fix your bugs before release 😉
Yes I agree that we have far too many exceptions. Most common ones is conflict between users. So 2 users try to update the same thing. One win and one loose.
And that in turn depends on the workflow. Many users see and edit the same data. We have OSS service (Object Synchronization Service) but it can take a second or 2 before all users are notified on a change.
But there is also other exceptions that actually should be fixed.
But this is a separate issue. It is just that it is not realistic to create a new post in issuetracker for all exceptions.Now we read logs and create issues manually in issuetracker.
-
My team maintains a big multiuser application. Biggest customer has about 200 users. Callstacks from exceptions is generated with JCL and logged to a text-file for each session together with other kind of loggings.
Now we have idea to switch to EurekaLog instead as we have some strange random exceptions. Probably wrong memoryhandling.
Any advice for a good plan for this ?
Currently we have tools that parse the log-files to read exceptions and add it to a datebase.
Then we can view list of most common exceptions. List of most common callstacks etc
EurekaLog has its own logviewer and database but it is completely different.
Not sure how well that works with the huge amount of data we have.Can we have maybe logging to both old format and new format?
Comments appreciated 😊 -
I can of course not say I made this as the channel header tell. My contribution is very minor. But I want to share this story anyway.
And hopefully someone can use or even contribute to Bold framework.
Yesterday I committed a bunch of updates to Bold for Delphi https://github.com/Embarcadero/BoldForDelphi/tree/develop
History of Bold for Delphi
Bold for Delphi is a Model-Driven Architecture (MDA) framework developed in the late 1990s by BoldSoft, a Swedish company. Jan Norden was one of thefounders.
Bolds main focus was to enable developers to create business applications by defining the application's data structure and business rules at a higher abstraction level, rather than writing low-level code manually.
In 2002, Borland acquired BoldSoft, and Bold for Delphi was included in Borland’s release of Delphi 7 Architect. This made the framework more accessible to Delphi developers and encouraged its adoption within the Delphi ecosystem.
However, after Borland sold its development tools division to CodeGear. Later Embarcadero took over. Now Bold for Delphi was no longer actively developed as part of the Delphi IDE.
Bold for Delphi was used in many hundreds of projects with Delphi 7. Developers was now abandoned with no support from Code/Gear/Embarcadero.But development never stopped completely. Before Borland bought Boldsoft Ahola Transport, a Finnish company bought source-code license from Boldsoft.
They developed an in-house ERP application Attracs for transport business now with full access to Bolds source.Around 2010 Attracs company hired a consultant Daniel Mauric from Serbia mainly because hes deep knowledge about Bold.
This turned out to be a very good move. Now the development of Bold for Delphi really gained momentum.
Daniel has made countless optimizations, bug fixes but also some completely new additions to Bold.
But one problem was that Bolds Intellectual Property (IP) was still hold by Embarcadero.
We couldn't legally publish our changes even if we want to cooperate with other developers around the source.
In May 2012 I Roland Bengtsson made a petition to release Bold with opensource license.
And the petition got attention. After a while when I contacted Embarcadero we agreed on a meeting and it looks promising.
But later Embarcadero changed their mind and set up unreasonable conditions like all changes with source remain Embarcaderos IP. And the years passed...Delphi product manager at Embarcadero changed to Marco Cantu. When I discussed this issue with him I noticed quickly he had a more realistic view on this.
Marco realized that the only way forward was to make Bold opensource. I have no idea what happened behind the scenes but Marco convinced Embarcaderos management and published this blog 22 Sep 2020
So a big thank you to @Marco Cantu for his work!
Our company now renamed to Ahola Digital continue to work with our main Bold application Attracs.
Our Bold source continue to improves thanks to Daniel Mauric.
These changes are now published in repository above.There is a lot more to do. Many inhouse tools and source are not commited in to repository yet.
Main Purpose of Bold for Delphi
The primary purpose of Bold for Delphi is to simplify the development of business applications by automating data persistence, object lifecycle management, and business rule enforcement.
It emphasizes separation of concerns by letting developers focus on defining the model (business logic and rules) while the framework handles boilerplate tasks such as:
- Object-relational mapping (ORM)
- Automatic data synchronization with a database
- Real-time data updating in the user interface
- Implementation of business logic constraints and rules
It essentially follows the MDA approach, where application logic is derived from the model, reducing repetitive code writing and increasing consistency across applications.
Main Components of Bold for Delphi
-
Bold Model and UML Integration:
- Developers define the application’s data model using UML diagrams.
- Rational Rose is supported but unfortunately IBM have
- The model is then translated into Delphi classes with associated behavior and persistence rules.
-
Bold Business Classes:
- These are Delphi classes generated from the UML model.
- They represent the business objects, containing properties, associations, and behavior logic.
-
Bold Object Layer:
- Handles the lifecycle of objects, including creation, deletion, and memory management.
- Ensures real-time synchronization between the application and the database.
-
Bold Persistence Layer:
- Manages object persistence by mapping the Bold business classes to database tables.
- Abstracts database interactions, so developers don't need to write SQL manually.
-
Bold Expression Language (OCL):
- A query and constraint language similar to SQL but designed for object models.
- Used to express rules, queries, and computed attributes in the model.
-
Bold User Interface Components:
- Data-aware UI components, such as grids and editors, are bound directly to the Bold object model.
- Provides real-time updates as the model changes.
-
Bold Subscription System:
- Ensures the UI and other dependent components react automatically when model data changes.
Key Advantages of Bold for Delphi
- Rapid Development: Reduces repetitive coding by generating classes and managing persistence automatically.
- Model-Driven Approach: Ensures the application's logic and design are consistent and well-structured.
- Scalability: Supports complex object relationships and business rules with minimal effort.
- Real-Time Updates: Automatically synchronizes UI and data layers for responsive applications.
Example Use Cases
Bold for Delphi is particularly suited for:
- Enterprise resource planning (ERP) systems
- Customer relationship management (CRM) systems
- Applications with complex domain models and business rules
It remains a valuable tool for Delphi developers who need to build sophisticated, model-driven applications efficiently.
If you are interested to contribute or just have a question about Bold do not hesitate to ask me.
I would do my best to help!-
10
-
3 minutes ago, David Schwartz said:The title of this thread is "Backward compability". That's referring to the ability to take OLDER versions of projects and build them in NEWER versions of Delphi, and it mainly applies to the language features and VCL. For example, you can still compile programs that declare 'object' types that existed briefly before the 'class' designation showed up. It has been deprecated for 25+ years, but it still works. You can even build old TurboPascal apps and there's a very good chance they'll compile and run without any issues.
However, going from a NEWER version to an OLDER version has NEVER been supported.
Needless to say, the error you're pointing to is not even in the language nor the VCL, so it's totally outside of Delphi's product domain. Meaning ... you're barking up the wrong tree.
Third-party vendors frequently add updates to their libraries. Embt updates Delphi's language and the VCL very infrequently, mostly when a new major version is released.
OTOH, companies like TMS Software (among others) frequently release updates based on bugs and requests submitted by their users. I don't know what library this is, but if it's DevEx, then I believe they update their subscribers quarterly.
I've worked on projects where we used components from TMS, and in some cases, certain team members loved to complain about the frequency of updates, and they didn't bother doing them sometimes. I always update my libraries regularly, especially if there's something pushed out that fixes a bug or problem I encountered. If I do that and then commit an update, it's highly likely that someone who has not updated their TMS libs will encounter these same errors when attempting to build my code. That's not my fault! Nor does it have anything to do with either Delphi or "backward compatibility". (Frankly, it's a Project Management issue.)
The moral of the story is, if you update a library and commit the code for it to your repo, then try opening that latest version on a machine that's got an older version of the library installed, then this is something that's VERY likely to happen. It doesn't matter what version of Delphi it is -- this is saying a property added to a class recently is missing from the version you've got installed on that machine, which is not terribly uncommon. You need to update the library, not Delphi.
Yes I understand I was wrong. Btw it was a property in a new version of Devexpress that caused this problem.
-
1
-
-
This error seems to be because of Developer Express upgrade. So should not blame Delphi IDE... 😁
-
Delphi have a good reputation of being compatible. You can take old source code and it often compile fine in latest Delphi.
My team are in the process of upgrading from 11.3 to 12.2.
I have been using 12.2 for a while.
When I transfer a form, pas-file and dfm-file from 12.2 to 11.3 I got this error in 11.3So 12.2 add a new property that is unknown in 11.3.
It is a pity because now I have to be careful what to commit with 12.2to not commit these attributes by mistake.
-
Bit late to comment this thread...
Anyway I use Starteam from Borland in the past. It was slow and not reliable.
2013 the database was corrupted so our team has to change source control system.
We choosed Git and Github as that seems to be standard even at that time.
SmartGit was choosen as client as none of us want to spend time to learn git commandline.
Yes there was some hick ups in the beginning because we didn't understand the concept.The common solution was to delete local source folder and clone a new one from Github.
Now this never happen anymore.
Git is great both for small one man size projects and for big projects maintained by a team.
It is simple if you are the only one that change it as there can be no conflicts.
And in case your computer start burning or something you have a backup on github.In a team conflicts can occur. Often git handle that fine but if 2 people make change in same file you have to merge changes manually.
-
Eventlog show
Faulting application name: bds.exe, version: 29.0.53571.9782, time stamp: 0x66d2e9f2
Faulting module name: AttracsComponentsXE12Athens.bpl_unloaded, version: 1.0.0.0, time stamp: 0x6731159b
Exception code: 0xc000041d
Fault offset: 0x0093958c
Faulting process ID: 0x2b50
Faulting application start time: 0x01db33ad2fc10672
Faulting application path: C:\Program Files (x86)\Embarcadero\Studio\23.0\bin\bds.exe
Faulting module path: AttracsComponentsXE12Athens.bplAttracsComponentsXE12Athens.bpl is an own custom package that contain both own components and commercial we bought with source. So in this case eventlog was actually useful.
-
1
-
-
Thanks, will look at eventlog. But honestly Windows eventlog itself is cryptic. It has never shown any valuable information for me...
-
I have a problem with stability in Delphi 12.2. IDE can just die without any error.
The process BDS.exe is just gone and this can happen after some time like 10 to 30 minutes of working.Unfortunately my subscription ended previous month so I cannot download the latest from my.embarcadero.com
but I have saved an older exe-file for installation. I can then use Getit to install the patchWhen installing I use the webinstaller and only install Delphi and Windows as target platform.
Also Help, fonts and DUnit. Everything else is uncheckedVersion is now 29.0.53571.9782
Delphi 12 and C++ Builder 12 Update 2
RAD Studio 12.2 Patch 1DevExpress 24.1.7 is also installed.
I have tried reinstalled Delphi and Devexpress from scratch.
I am stuck how to fix this
I doubt BSD.exe itself is unstable.
Host OS is Ubuntu 24.04Delphi is running on Windows 10 Pro with KVM.
This setup works fine with Delphi 11.3.So I just copied that to a new VM, uninstall 11.3 and installed 12.2.
No other plugins are used for now.
Slow performance. HELP!
in General Help
Posted · Edited by Berocoder
We have an application that pump data from main database to another smaller database. So it just reads from production DB. But it reads a lot!
When we turned off that most of the conflicts was gone.
The use case for the application is analyze of data. Turn off that is not so popular in management.
But we know more now at least