is there a trick to know that a property of EO did change?

2020-05-24 Thread ocs--- via Webobjects-dev
Hi there,

I'd need to get a notification whenever a property of my EO changes, be it 
directly through a setter, or through an inverse-relationship being maintained, 
or through an object of an M:N deleted, whatever way. Something like

class MyEO extends ERXGenericRecord {
  void propertyDidChange(String key) {
... to be called just after any property of mine changes, with its key ...
  }
}

Does EOF or WOnder provide something like that? Whatever I try, I can't find 
it. I could easily observe willChanges of course, but that's something rather 
different...

Thanks,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: is there a trick to know that a property of EO did change?

2020-05-25 Thread ocs--- via Webobjects-dev
Thanks all!

I had no big luck with overridden accessors: for one, it was sort of at the 
dangerous side, never sure whether I won't forget one or two. And besides, I 
can be wrong, but it seems to me sometimes EOF does not go through the 
accessors, but changes the underlying data directly — e.g., if an object in a 
relationship gets deleted, my removeObjectFromFoo was never called (perhaps I 
did something wrong at my side).

Eventually, I have tried the code below in my EO constructor (although the 
observe thing is my own undocumented String extension, I believe it's behaviour 
would be self-evident), and so far it seems to work quite nicely. Will see when 
testers get the thing to their hands :)

===
EOEditingContext.ObjectsChangedInEditingContextNotification.observe { 
NSNotification nn ->
if (!editingContext) return // seems we might get the notification a 
bit too soon in the object's lifetime; awakeFromInsertion/Fetch might be better 
choice

[EOObjectStore.UpdatedKey,EOObjectStore.DeletedKey,EOObjectStore.InsertedKey,EOObjectStore.InvalidatedKey].each
 {
nn.userInfo[it].each { eo ->
if (eo===this) {
Map chg=this.changesFromCommittedSnapshot()
... process changes as needed ...
}
}
}
}
===

Thanks and all the best,
OC

> On 25. 5. 2020, at 6:39 AM, Michael Sharp  wrote:
> 
> ERXGenericRecord.changesFromCommittedSnapshot
> 
> if (changesFromCommittedSnapshot().containsKey(MY_KEY)) {
>  propertyDidChange(MY_KEY);
> }
> 
> As mentioned by Aaron this could be wedged into overridden setters, 
> validate methods or even worked into your eogen template if you 
> wanted this behaviour model wide.
> 
> It might also be worth looking at the audit trail implementation in 
> ERCoreBusinessLogic for ideas on a configurable observer/notifier.
> 
> Sharpy.
> 
> 
> 
>> On 25 May 2020, at 10:40 am, ocs--- via Webobjects-dev 
>>  wrote:
>> 
>> Hi there,
>> 
>> I'd need to get a notification whenever a property of my EO changes, be it 
>> directly through a setter, or through an inverse-relationship being 
>> maintained, or through an object of an M:N deleted, whatever way. Something 
>> like
>> 
>> class MyEO extends ERXGenericRecord {
>> void propertyDidChange(String key) {
>>   ... to be called just after any property of mine changes, with its key ...
>> }
>> }
>> 
>> Does EOF or WOnder provide something like that? Whatever I try, I can't find 
>> it. I could easily observe willChanges of course, but that's something 
>> rather different...
>> 
>> Thanks,
>> OC
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/getsharp%40gmail.com
>> 
>> This email sent to getsh...@gmail.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: EC locking/shared snapshots/old data saved

2020-05-29 Thread ocs--- via Webobjects-dev
Jesse,

> On 29. 5. 2020, at 3:15 PM, Jesse Tayler  wrote:
> Well, I don’t know but I think the fact you’d be having this problem points 
> to another problem.

Perhaps it does, but frankly, I can't see that.

> I don’t know your traffic or architecture, but you really should not have 
> that problem at all, I wonder if perhaps you are creating too many separate 
> ECs?

Not really. Unless I am missing something of importance (do please correct me 
if so), the problem can happen whenever

(i) there are at least two different ECs;
(ii) through which different properties of same object are changed;
(iii) and, at least one EC is locked before changes and unlocked after saving 
(otherwise, we'd get the possible solution (a));

in a multi-threaded environment (background threads, 
WOAllowsConcurrentRequestHandling, or both).

> I find myself generally putting the bulk of operations into one EC and 
> sometimes creating others for one-off stuff or just because it is a linear 
> process with clear results.

Well each user would have normally his own EC in his own session; along with 
WOAllowsConcurrentRequestHandling and standard EC locking that would be quite 
sufficient to create the problem, I believe, far as (ii) and (iii) happen, too. 
Normally with Wonder auto-locking (iii) does; as for (ii), it depends on the 
code, but is pretty probable.

Background threads do not change the principle at all; they just might increase 
the probability this happens if they lock their ECs, for they typically run for 
much longer than R/R loop workers.

> Recently I did a lot of invalidating objects based on flags that were likely 
> to require updating from a remote thread, this isn’t a conflict but I did 
> need to ensure those objects were fetched and their contents written over 
> what is in memory.
> 
> In that case, the user operating the session was really the only part that 
> needed instant updates and only in certain circumstances.

Well if your session user's code either updates the changes (through 
unlock/lock? Or in antoher way? If so, how?) or does not make his own changes 
(of other properties of the same object), or does not save after the thread 
does, there's no problem I guess.

> Anyway, I’d think about the problem more broadly since I’m personally 
> confident WO/Wonder has the most logical locking and EC handling that has 
> been honed and crafter over decades and used in all kinds of situations.

I believe the root of the problem is the shared snapshot, which is a WO-level 
quirk (understandable to save memory, but potentially leading to this pitfall).

> That confidence would lead me to at least try and solve your issues in 
> another way perhaps

Perhaps, I'd be grateful for any reasonable way to solve it.

The (a) — shown in the test code below, too — still looks to me as a pretty 
nice and easy solution; I just wonder why Wonder (sorry, couldn't resist) does 
not do that automatically in ERXEC.saveChanges? Would it perhaps cause some 
other grave problems which I can't see myself (but will be bit by them hard if 
I try to do that myself in my own EC subclass)?

To better elucidate, it can be tested by a code similar to this (it's Groovy, 
and a bit tweaked at that; but I believe readable and understandable enough — I 
must admit in those years I use this infinitely better language I essentially 
forgot how to write in pure Java and would take me a small eternity to re-write 
into the darned thing :))

===
WOComponent test(unlockEC) {
eo.foo="new" // eo's some EO in defaultEC; assume string attributes 
foo/bar, works with any property same way
def entity=eo.entityName,key=eo.rawPrimaryKey // for simplicity. Works 
with any way of fetching the object
Thread.start { // thread just simulates another user changing 'bar' and 
saving in his own EC of his own session
ERXEC ec=ERXEC.newEditingContext() // locking here irrelevant: 
neither harms nor helps in this case
def obj=EOUtilities.objectWithPrimaryKeyValue(ec,entity,key)
obj.bar="new"
ec.saveChanges()
println "thread: saved, foo is '$obj.foo' bar '$obj.bar'" // both 
would be new; so far so good
}
Thread.sleep(100) // simulate just a bit slow processing of whatever
if (unlockEC) { // this fixes the problem in a way of (a) mentioned 
below
eo.editingContext.unlock() // ... for here the changes from the 
thread are merged-in
eo.editingContext.lock()
}
eo.editingContext.saveChanges()
println "saved, foo is '$eo.foo' bar '$eo.bar'" // if !unlockEC, bar 
would be old, oops!
}
WOComponent test { test(NO) } // this action causes the problem (that after 
all's done, bar's again the old one)
WOComponent testUnlocking { test(YES) } // this sports the 
possible-solution (a) and works properly
===

If you don't like the thread, precisely the same can be done with two actions — 
one with the de

Entity/attribute/relationship terrible toString?

2020-06-01 Thread ocs--- via Webobjects-dev
Hi there,

occasionally, I need to put entities/attributes/relationships into complex 
nested property lists. Occasionally for debug, I need to print out these 
property lists.

Alas, entities/attributes/relationships normally print out their complete 
contents in their toStrings, which makes the logs completely unuseable (and 
when there's more of them in a property list, actually bogs down the 
application so much it must be killed).

Isn't there some trick to make those darned model classes toString something 
reasonable, e.g., just their class, name and hash?

Thanks,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Entity/attribute/relationship terrible toString?

2020-06-02 Thread ocs--- via Webobjects-dev
Paul,

> On 2. 6. 2020, at 2:05 PM, Paul Yu  wrote:
> There are two templates _EO and EO.java that are used by eogenerate to create 
> your EO classes.  If you open your Eogenerate File you can see where your 
> templates are.

Can't recall anything like that from WO. Isn't that some 
Eclipse/WOLips-specific thing? I don't use Eclipse anymore; I am yet to see a 
worse IDE. Having tested many of them (and having suffered with Eclipse for 
some years), eventually I stick with Xcode, which is far from perfect too and 
it definitely has a plethora of ugly quirks, but at the very least it is 
infinitely better than the Eclipse disaster (and aside of that, I do all my *OS 
development in there, and it's quite convenient to use one and the same IDE for 
all the work; myself, I found switching IDEs really inconvenient. As always, 
your mileage may vary ;))

Besides, well, you got me ranting, but anyway: I do not, not, not use generated 
code, in my opinion and experience, that's one very very bad approach. My EO 
classes are based on my own superclass which reads in the model at startup and 
installs the appropriate accessors dynamically (in a way quite similar, though 
of course not identical, to CoreData). And it, quite naturally, also contains 
my own overridden toString.

Which all seems to me completely beside the point. From the very beginning, I 
am writing of entities/attributes/relationships, not EO classes. I can do 
almost whatever I want with the EO classes, but so far, I haven't succeeded to 
find any way to affect toStrings of entities/attributes/relationships (i.e., 
the EOEntity, EOAttribute and EORelationship class).

Or do I miss something of importance here?

Thanks,
OC

>> On Jun 2, 2020, at 7:04 AM, OCsite via Webobjects-dev 
>>  wrote:
>> 
>> Markus,
>> 
>>> On 2 Jun 2020, at 12:09, Markus Ruggiero  wrote:
>>> Why not simply override toString() in EOGenerate templates once and for all?
>> 
>> What are “EOGenerate templates” and how they affect the 
>> entities/attributes/relationships toStrings? I can't find anything like that 
>> in my WO documentation. Seems it might be the right solution... if I knew 
>> what it is :)
>> 
>> Thanks!
>> OC
>> 
>>> 
>>>>> On 2 Jun 2020, at 01:52, ocs--- via Webobjects-dev 
>>>>>  wrote:
>>>> 
>>>> Hi there,
>>>> 
>>>> occasionally, I need to put entities/attributes/relationships into complex 
>>>> nested property lists. Occasionally for debug, I need to print out these 
>>>> property lists.
>>>> 
>>>> Alas, entities/attributes/relationships normally print out their complete 
>>>> contents in their toStrings, which makes the logs completely unuseable 
>>>> (and when there's more of them in a property list, actually bogs down the 
>>>> application so much it must be killed).
>>>> 
>>>> Isn't there some trick to make those darned model classes toString 
>>>> something reasonable, e.g., just their class, name and hash?
>>>> 
>>>> Thanks,
>>>> OC
>>>> 
>>>> ___
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/webobjects-dev/steiner%40rucotec.ch
>>>> 
>>>> This email sent to stei...@rucotec.ch
>>> 
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/pyu%40mac.com
>> 
>> This email sent to p...@mac.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Entity/attribute/relationship terrible toString?

2020-06-02 Thread ocs--- via Webobjects-dev
Aaron,

> On 2. 6. 2020, at 7:40 PM, Aaron Rosenzweig  wrote:
> Generally I don’t have logging coming out about relationships nor the object 
> graph.

Yea, same here; in decades of using WO I've bumped into the model class 
toString madness just a couple of times, neither of them serious.

Nevertheless in my current project I've got an issue collector, which collects 
issues by owner; and it so happens that aside of EOs and other “normal” objects 
(none of which makes any problem) some issues might be owned by entities and/or 
attributes of a model (luckily, so far, not by a model itself; the thing far as 
I recall toStrings its complete contents too. Ick!)

Normally, it still works quite all right, but if there's a problem and I switch 
my logs to trace level or below, I am printing out all the underlying data 
structures, which happen to be sorta complex maps (and weakhashmaps and similar 
beasts), and the model classes do real big harm in there.

> I suppose you’ll have to look at what is generating those logs and have some 
> sort of preprocessor that does something “smart” for the display of your 
> object graph. Maybe a big if/else block for each your relationships or maybe 
> something generic if that’s good enough that has heuristics for display 
> names. 

Yup, I've considered that, but to be forced to implement a complete property 
list recursive printout myself, solving properly all the Iterables and Maps and 
Object[]'s and hell-knows-what just to tame an idio... well, ahem, 
not-too-reasonably implemented toString of three classes seems just a bit at 
the rube-goldbergish side to me :/

Thanks anyway!
OC

>> On Jun 2, 2020, at 1:36 PM, ocs--- via Webobjects-dev 
>> mailto:webobjects-dev@lists.apple.com>> 
>> wrote:
>> 
>> Paul,
>> 
>>> On 2. 6. 2020, at 2:05 PM, Paul Yu mailto:p...@mac.com>> 
>>> wrote:
>>> There are two templates _EO and EO.java that are used by eogenerate to 
>>> create your EO classes.  If you open your Eogenerate File you can see where 
>>> your templates are.
>> 
>> Can't recall anything like that from WO. Isn't that some 
>> Eclipse/WOLips-specific thing? I don't use Eclipse anymore; I am yet to see 
>> a worse IDE. Having tested many of them (and having suffered with Eclipse 
>> for some years), eventually I stick with Xcode, which is far from perfect 
>> too and it definitely has a plethora of ugly quirks, but at the very least 
>> it is infinitely better than the Eclipse disaster (and aside of that, I do 
>> all my *OS development in there, and it's quite convenient to use one and 
>> the same IDE for all the work; myself, I found switching IDEs really 
>> inconvenient. As always, your mileage may vary ;))
>> 
>> Besides, well, you got me ranting, but anyway: I do not, not, not use 
>> generated code, in my opinion and experience, that's one very very bad 
>> approach. My EO classes are based on my own superclass which reads in the 
>> model at startup and installs the appropriate accessors dynamically (in a 
>> way quite similar, though of course not identical, to CoreData). And it, 
>> quite naturally, also contains my own overridden toString.
>> 
>> Which all seems to me completely beside the point. From the very beginning, 
>> I am writing of entities/attributes/relationships, not EO classes. I can do 
>> almost whatever I want with the EO classes, but so far, I haven't succeeded 
>> to find any way to affect toStrings of entities/attributes/relationships 
>> (i.e., the EOEntity, EOAttribute and EORelationship class).
>> 
>> Or do I miss something of importance here?
>> 
>> Thanks,
>> OC
>> 
>>>> On Jun 2, 2020, at 7:04 AM, OCsite via Webobjects-dev 
>>>> mailto:webobjects-dev@lists.apple.com>> 
>>>> wrote:
>>>> 
>>>> Markus,
>>>> 
>>>>> On 2 Jun 2020, at 12:09, Markus Ruggiero >>>> <mailto:mailingli...@kataputt.com>> wrote:
>>>>> Why not simply override toString() in EOGenerate templates once and for 
>>>>> all?
>>>> 
>>>> What are “EOGenerate templates” and how they affect the 
>>>> entities/attributes/relationships toStrings? I can't find anything like 
>>>> that in my WO documentation. Seems it might be the right solution... if I 
>>>> knew what it is :)
>>>> 
>>>> Thanks!
>>>> OC
>>>> 
>>>>> 
>>>>>>> On 2 Jun 2020, at 01:52, ocs--- via Webobjects-dev 
>>>>>>> >>>>>> <mailto:webobjects-

data source for “static” objects?

2020-06-07 Thread ocs--- via Webobjects-dev
Hi there,

let me please ask another weird question. For the context, thing is, one of our 
applications supports “predefined” EOs -- things like static lists and similar. 
In our case, they are completely defined in the Java code -- the number of 
them, all their attributes, whatever. Then, runtime, they are shared for all 
users/sessions/editing contexts.

Since they need to be real EOs (they mix with normal dynamically defined 
objects, they are part of relationships, etc), it brings non-trivial problem 
how to implement the stuff.

At this moment, we
- at launch, synchronise these objects into the database: if the Java code 
defines a new object which has not been there, it is inserted; if there are 
changes in attributes, they are updated. If an object of this kind is found in 
the database and there's no description for it in the Java code, it is deleted;
- then we load them into the shared EC for all users to share them.

It works, but the synchronisation approach is ugly; it feels sort of wrong to 
keep copies of those static objects in the database.

Now, I wonder: EOF does support multiple data sources. How difficult and 
error-prone would it be to implement my own data source, which would -- instead 
of from a DB -- “load” objects from the application predefined code? Would it 
be possible? Wouldn't it bring more problems than the old code did? To 
illustrate the idea, here's the notorious Apple pic, tweaked appropriately:


Has anybody out there already tried something like that, and if so, with any 
luck?

Thanks,
OC



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: data source for “static” objects?

2020-06-07 Thread ocs--- via Webobjects-dev
Chuck,

thanks a lot, sounds hopeful :)

Will check. Should you happen to have a link to some sample code at hand, I'd 
be grateful; otherwise of course I'll search for it myself :)

Thanks again,
OC

> On 7. 6. 2020, at 8:06 PM, Chuck Hill  wrote:
> 
> I think what you want is to subclass EOAadptor, EOAdaptorChannel, and 
> EOAdaptorContext and have them talk to your Java classes.  The layer above 
> (EODatabase etc) can stay are they are.
> 
> There have been flat file adataptors, screen scrapers etc.  I don’t see why 
> what you want could not work.  The model the entities are in control the 
> EOAdaptor used.
> 
> Chuck
> 
> 
>> On Jun 7, 2020, at 10:02 AM, Aaron Rosenzweig via Webobjects-dev 
>> mailto:webobjects-dev@lists.apple.com>> 
>> wrote:
>> 
>> Hi OC,
>> 
>> I suppose you could move your java POJOs into a .jar and then expose them 
>> with a java app running on a particular port that masquerades as a DB 
>> endpoint. I’m not sure it’s worth the trouble but it could be done. This 
>> would be the “my DB in a box” solution where you essentially make trimmed 
>> down DB server that doesn’t allow updates but allows SQL queries. It gets 
>> weird though with EOF and honestly I’ve never tried jumping DBs for foreign 
>> keys. I’ve only used multiple DBs to do queries on unrelated data. 
>> 
>> I assume you like how handy it is to have the java classes at your finger 
>> tips and able to edit them when needed but you also like to be able to query 
>> in SQL for various attributes that those POJOs have… so you go to the 
>> trouble of making an EO doppelgänger that you have to sync. 
>> 
>> Perhaps you can make your POJOs enums? If that’s feasible then you could use 
>> the enum prototype in your EO so that instead of having an FK it is an 
>> attribute of an enum type. 
>> 
>> If enums are not feasible then maybe you should stop thinking of them as 
>> POJOs and make them EOs which you have to change via SQL migrations instead 
>> of twiddling java classes. That would be the path of least resistance. Since 
>> they are pretty much read only, you could consider making them shared Eos 
>> but it’s not mandatory to do so. 
>> AARON ROSENZWEIG / Chat 'n Bike <http://www.chatnbike.com/>
>> e:  aa...@chatnbike.com <mailto:aa...@chatnbike.com>  t:  (301) 956-2319
>>  
>> 
>>> On Jun 7, 2020, at 12:37 PM, ocs--- via Webobjects-dev 
>>> mailto:webobjects-dev@lists.apple.com>> 
>>> wrote:
>>> 
>>> Hi there,
>>> 
>>> let me please ask another weird question. For the context, thing is, one of 
>>> our applications supports “predefined” EOs -- things like static lists and 
>>> similar. In our case, they are completely defined in the Java code -- the 
>>> number of them, all their attributes, whatever. Then, runtime, they are 
>>> shared for all users/sessions/editing contexts.
>>> 
>>> Since they need to be real EOs (they mix with normal dynamically defined 
>>> objects, they are part of relationships, etc), it brings non-trivial 
>>> problem how to implement the stuff.
>>> 
>>> At this moment, we
>>> - at launch, synchronise these objects into the database: if the Java code 
>>> defines a new object which has not been there, it is inserted; if there are 
>>> changes in attributes, they are updated. If an object of this kind is found 
>>> in the database and there's no description for it in the Java code, it is 
>>> deleted;
>>> - then we load them into the shared EC for all users to share them.
>>> 
>>> It works, but the synchronisation approach is ugly; it feels sort of wrong 
>>> to keep copies of those static objects in the database.
>>> 
>>> Now, I wonder: EOF does support multiple data sources. How difficult and 
>>> error-prone would it be to implement my own data source, which would -- 
>>> instead of from a DB -- “load” objects from the application predefined 
>>> code? Would it be possible? Wouldn't it bring more problems than the old 
>>> code did? To illustrate the idea, here's the notorious Apple pic, tweaked 
>>> appropriately:
>>> 
>>> 
>>> Has anybody out there already tried something like that, and if so, with 
>>> any luck?
>>> 
>>> Thanks,
>>> OC
>>> 
>>> 
>>> 
>>> ___
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mail

Looks like an OSC must be disposed manually?!? (was: background tasks locked, workers run all right)

2020-06-29 Thread ocs--- via Webobjects-dev
Hi there,

it seems finally I succeeded to find the culprit of the problem described 
below. Far as my testing shows, it seems an ObjectStoreCoordinator is never 
garbage collected (presumed it has been used at least once for a fetch). Since 
the OSC opens a socket to the database, this leads to the problem with a number 
of open sockets for a process. Far as my testing shows, the only way to make it 
to do poof is to call dispose manually, which seems a bit at the unexpected 
side, at least for me.

My current test code looks like this:

===
class MainPage extends OCSComponent {
def test {
def osc=new OCSOSC(),ec=new OCSEC(osc)
println "created $osc and $ec"
def obj=EOUtilities.objectWithPrimaryKeyValue(ec,'DBAuction',101) 
//[FETCH]
println "got obj $obj and dying..."
ec=nil
osc.dispose() //[WHATTHE]
osc=nil
System.gc()
nil
}
}
class OCSOSC extends EOObjectStoreCoordinator {
void finalize() {
println "### $this about to die"
}
}
@InheritConstructors class OCSEC extends ERXEC {
void finalize() {
println "### $this about to die"
}
}
===

If both the lines marked [FETCH] and [WHATTHE] above are commented out, i.e., 
if the OSC never fetches, both the osc and ec objects report finalizing without 
a need to dispose.

Nevertheless, once the fetch happens as above, [WHATTHE] must be active too — 
otherwise only ec gets garbage collected; osc never ever does (and subsequently 
also never releases its DB socket). 

Well the explicit dispose seems to be the fix for my problem, so far it seems 
to work properly; but since I did not find any mention of calling dispose 
manually nor using a dispose registry in the documentation (otherwise than 
those two registries related to archivation and D2JClient), I wonder whether 
this is the proper approach, or whether I am doing something wrong and sooner 
or later I am in for an ugly surprise? Any insight here?

Thanks a lot,
OC

> On 21. 5. 2020, at 1:13 PM, OCsite  wrote:
> 
> Hi there,
> 
> bumped lately into another weird problem. We import some data into DB in 
> background tasks. Up to yesterday, it worked normally; today six import tasks 
> were launched, and each of them seemingly hang in its first DB operation. 
> Restart did help; alas, the site admins did not try to ask JVM to detect 
> deadlocks when they restarted the application.
> 
> The background task looks like this:
> 
> ===
> class ImportCSVTask extends ERXLongResponseTask.DefaultImplementation {
> def performAction {
> _thread.priority=Thread.MIN_PRIORITY
> try {
> try {
> editingContext=ERXEC.newEditingContext(objectStore=new 
> EOObjectStoreCoordinator())
> editingContext.lock()
> lognow 1, "=== preparing CSV import in EC $editingContext ==="
> 
> formPrototype=ERXEOGlobalIDUtilities.fetchObjectWithGlobalID(editingContext,formPrototypeGID)
> lognow 1, "=== local prototype $formPrototype ==="
> ... ...
> ===
> 
> Always the “preparing” log was the last thing those threads presented; none 
> of them ever reported “local prototype”. There's no other related log in 
> there.
> 
> Meantime the application ran normally and the worker tasks communicated with 
> the database all right (with an occasional report that some select took 
> 70-odd ms from ERXAdaptorChannelDelegate, we have the threshold at 50). We 
> run with   ERXObjectStoreCoordinatorPool.maxCoordinators=1.
> 
> Any idea what could have gone wrong and how to find the culprit and prevent 
> the problem in future? I thought a new EC in a new OSC can't be blocked for 
> long, but self-evidently, I was wrong, they seemed to lock indefinitely 
> (application was restarted ten-odd hours after the first import hanged after 
> its “preparing” report, still no “local prototype”).
> 
> Thanks and all the best,
> OC
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Looks like an OSC must be disposed manually?!? (was: background tasks locked, workers run all right)

2020-06-29 Thread ocs--- via Webobjects-dev
Aaron,

thanks, this I hope I sort of understand.

Still, in the garbage-collected environment, any object, far as I can say, 
should

(a) be automatically disposed when there's no explicit reference to it, 
regardless of whether it is cheap or big;
(b) if there's some internal means to keep unreferenced objects alive forever, 
it should be explicitly documented (e.g., like 
EOObjectStoreCoordinator.defaultCoordinator()).

What am I overlooking? And, much more important question: is the explicitly 
called dispose indeed the right and safe way to get rid of an OSC, wouldn't it 
cause some other problems elsewhere in the future?

Thanks,
OC

> On 29. 6. 2020, at 4:17 PM, Aaron Rosenzweig  wrote:
> 
> OSC is a cursor to the DB. They aren’t particularly cheap to acquire. As far 
> as I know, they live until you dispose of them. They don’t automatically 
> dispose. They are not cheap like an editingContext. One OSC can service a 
> plethora of editingContexts. Simple WOApps have two OSC for the life of the 
> WOApp:
> 
> #1 made for the JDBCInfo, kind of dumb to keep around, Wonder has calls to 
> close this one. 
> 
> #2 stays around and used for any new editing context you make where you don’t 
> specifically give it a new OSC. 
> AARON ROSENZWEIG / Chat 'n Bike <http://www.chatnbike.com/>
> e:  aa...@chatnbike.com <mailto:aa...@chatnbike.com>  t:  (301) 956-2319
>   
> 
>> On Jun 29, 2020, at 10:12 AM, ocs--- via Webobjects-dev 
>> mailto:webobjects-dev@lists.apple.com>> 
>> wrote:
>> 
>> Hi there,
>> 
>> it seems finally I succeeded to find the culprit of the problem described 
>> below. Far as my testing shows, it seems an ObjectStoreCoordinator is never 
>> garbage collected (presumed it has been used at least once for a fetch). 
>> Since the OSC opens a socket to the database, this leads to the problem with 
>> a number of open sockets for a process. Far as my testing shows, the only 
>> way to make it to do poof is to call dispose manually, which seems a bit at 
>> the unexpected side, at least for me.
>> 
>> My current test code looks like this:
>> 
>> ===
>> class MainPage extends OCSComponent {
>> def test {
>> def osc=new OCSOSC(),ec=new OCSEC(osc)
>> println "created $osc and $ec"
>> def 
>> obj=EOUtilities.objectWithPrimaryKeyValue(ec,'DBAuction',101) //[FETCH]
>> println "got obj $obj and dying..."
>> ec=nil
>> osc.dispose() //[WHATTHE]
>> osc=nil
>> System.gc()
>> nil
>> }
>> }
>> class OCSOSC extends EOObjectStoreCoordinator {
>> void finalize() {
>> println "### $this about to die"
>> }
>> }
>> @InheritConstructors class OCSEC extends ERXEC {
>> void finalize() {
>> println "### $this about to die"
>> }
>> }
>> ===
>> 
>> If both the lines marked [FETCH] and [WHATTHE] above are commented out, 
>> i.e., if the OSC never fetches, both the osc and ec objects report 
>> finalizing without a need to dispose.
>> 
>> Nevertheless, once the fetch happens as above, [WHATTHE] must be active too 
>> — otherwise only ec gets garbage collected; osc never ever does (and 
>> subsequently also never releases its DB socket). 
>> 
>> Well the explicit dispose seems to be the fix for my problem, so far it 
>> seems to work properly; but since I did not find any mention of calling 
>> dispose manually nor using a dispose registry in the documentation 
>> (otherwise than those two registries related to archivation and D2JClient), 
>> I wonder whether this is the proper approach, or whether I am doing 
>> something wrong and sooner or later I am in for an ugly surprise? Any 
>> insight here?
>> 
>> Thanks a lot,
>> OC
>> 
>>> On 21. 5. 2020, at 1:13 PM, OCsite mailto:o...@ocs.cz>> wrote:
>>> 
>>> Hi there,
>>> 
>>> bumped lately into another weird problem. We import some data into DB in 
>>> background tasks. Up to yesterday, it worked normally; today six import 
>>> tasks were launched, and each of them seemingly hang in its first DB 
>>> operation. Restart did help; alas, the site admins did not try to ask JVM 
>>> to detect deadlocks when they restarted the application.
>>> 
>>> The background task looks like this:
>>> 
>>> ===
>>> class ImportCSVTask extends ERXLongResponseTask.DefaultImplementation {
>>> def performAction {
>>>   

Is it normal that ulimit hangs a thread instead of raising an exception or something like that?

2020-06-29 Thread ocs--- via Webobjects-dev
Oh, and there's one related question.

It seems to me particularly weird that if sockets caused by the stale OSCs 
exceed the ulimit, the threads which use these sockets hang. Is that the normal 
and presumed behaviour? I would expect myself an exception thrown instead, or 
something like that. Nevertheless, that's not what happens; those threads are 
simply stuck in reading from the database forever, like this (jstack output):

===
Thread t@37443: (state = IN_NATIVE)
 - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, 
int, int) @bci=0 (Compiled frame; information may be imprecise)
 - java.net.SocketInputStream.read(byte[], int, int) @bci=84, line=129 
(Compiled frame)
 - java.net.SocketInputStream.read() @bci=23, line=182 (Compiled frame)
 - java.io.FilterInputStream.read() @bci=4, line=66 (Compiled frame)
 - com.frontbase.jdbc.FBJSocket.readInt() @bci=4 (Compiled frame)
 - com.frontbase.jdbc.FBJSocket.checkForSecureCommunication() @bci=1 
(Interpreted frame)
 - com.frontbase.jdbc.FBJConnection.createConnection() @bci=709 (Interpreted 
frame)
 - com.frontbase.jdbc.FBJConnection.(com.frontbase.jdbc.FBJURL) @bci=116 
(Interpreted frame)
 - com.frontbase.jdbc.FBJDriver.connect(java.lang.String, java.util.Properties) 
@bci=22 (Interpreted frame)
 - java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties, 
java.lang.ClassLoader) @bci=210, line=582 (Interpreted frame)
 - java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties) 
@bci=7, line=154 (Interpreted frame)
 - com.webobjects.jdbcadaptor.JDBCContext.connect() @bci=251, line=236 
(Interpreted frame)
 - er.extensions.jdbc.ERXJDBCAdaptor$Context.connect() @bci=29, line=404 
(Interpreted frame)
 - com.webobjects.jdbcadaptor.JDBCContext._tryConnect() @bci=55, line=362 
(Interpreted frame)
 - com.webobjects.jdbcadaptor.JDBCContext._channelWillOpen() @bci=8, line=505 
(Interpreted frame)
 - com.webobjects.jdbcadaptor.JDBCChannel.openChannel() @bci=17, line=111 
(Interpreted frame)
 - 
com.webobjects.eoaccess.EODatabaseContext._openChannelWithLoginPanel(com.webobjects.eoaccess.EODatabaseChannel)
 @bci=19, line=1907 (Compiled frame)
 - com.webobjects.eoaccess.EODatabaseContext._obtainOpenChannel() @bci=62, 
line=1966 (Compiled frame)
 - 
com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(com.webobjects.eocontrol.EOFetchSpecification,
 com.webobjects.eocontrol.EOEditingContext) @bci=209, line=3054 (Compiled frame)
 - 
com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification,
 com.webobjects.eocontrol.EOEditingContext) @bci=34, line=3195 (Compiled frame)
 - 
com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification,
 com.webobjects.eocontrol.EOEditingContext) @bci=97, line=488 (Compiled frame)
 - 
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification,
 com.webobjects.eocontrol.EOEditingContext) @bci=79, line=4069 (Interpreted 
frame)
 - 
er.extensions.eof.ERXEC.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification,
 com.webobjects.eocontrol.EOEditingContext) @bci=10, line=1308 (Interpreted 
frame)
 - 
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification)
 @bci=3, line= (Interpreted frame)
 - 
er.extensions.eof.ERXEOGlobalIDUtilities.fetchObjectsWithGlobalIDs(com.webobjects.eocontrol.EOEditingContext,
 com.webobjects.foundation.NSArray, boolean) @bci=325, line=290 (Interpreted 
frame)
 - 
er.extensions.eof.ERXEOGlobalIDUtilities.fetchObjectsWithGlobalIDs(com.webobjects.eocontrol.EOEditingContext,
 com.webobjects.foundation.NSArray) @bci=3, line=229 (Interpreted frame)
 - 
er.extensions.eof.ERXEOGlobalIDUtilities.fetchObjectWithGlobalID(com.webobjects.eocontrol.EOEditingContext,
 com.webobjects.eocontrol.EOGlobalID) @bci=9, line=209 (Interpreted frame)
 - 
er.extensions.eof.ERXEOGlobalIDUtilities$fetchObjectWithGlobalID.call(java.lang.Object,
 java.lang.Object, java.lang.Object) @bci=18 (Interpreted frame)
 - others.ImportCSVTask.performAction() @bci=437, line=229 (Interpreted frame)
 - er.extensions.concurrency.ERXLongResponseTask$DefaultImplementation.run() 
@bci=25, line=166 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=695 (Interpreted frame)
 - er.extensions.concurrency.ERXLongResponseTask$WorkerThread.run() @bci=1, 
line=64 (Interpreted frame)
===

Thanks for any insight,
OC

> On 29. 6. 2020, at 4:12 PM, ocs--- via Webobjects-dev 
>  wrote:
> 
> Hi there,
> 
> it seems finally I succeeded to find the culprit of the problem described 
> below. Far as my testing shows, it seems an ObjectStoreCoordinator is never 
> garbage collected (presumed it has been used at least once for a fetch). 
> Since the OSC opens a socket to the dat

macOS deployment?

2021-04-30 Thread ocs--- via Webobjects-dev
Hi there,

for my own local testing purposes, I would need to deploy a couple of WO apps 
locally on a macOS, Catalina or Big Sur.

The traditional deployment approach bumps into lots of problems, starting with 
/System being very R/O, new Apache, etc. I've tried to find a page explaining 
howto, but in vain.

Did someone succeed to deploy on a current macOS? What's the easiest way to do 
that? (Load and security requirements are very low, for this case, I can accept 
a solution which works, even if it is slow/unsecure.)

Thanks a lot,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: macOS deployment?

2021-04-30 Thread ocs--- via Webobjects-dev
Jesse,

> On 30. 4. 2021, at 15:50, Jesse Tayler  wrote:
> I’ve been using Docker which of course, contains the whole thing quite nicely 
> for this sort of portability

Thanks!

Nevertheless, I regret to say I never ever heard of the Docker thing so far. Of 
course I can just open docker.com and start learning a whole new ecosystem, but 
frankly, I don't need any other great services it might offer; all I need is 
simply to deploy a couple of apps, and learning a whole new environment seems a 
bit steep price for that — is that the only way?

Or perhaps it would really help if there was a document “how to set up and 
deploy a WO application through Docker on Big Sur/Catalina 101 for complete 
dummies who more or less understand WO, JavaMonitor etc., but know zilch of 
Docker“. Is there something like that? I've tried to find one, but in vain 
(there seem to be similar things for Tomcat and Azure and whatsnot, there's 
even a “docker-webobjects-wotaskd” on github without seemingly any 
documentation... perhaps self-evident for people who understand Docker, but 
I've no idea :/ )

Thanks a lot,
OC

> 
>> On Apr 30, 2021, at 9:49 AM, ocs--- via Webobjects-dev 
>>  wrote:
>> 
>> Hi there,
>> 
>> for my own local testing purposes, I would need to deploy a couple of WO 
>> apps locally on a macOS, Catalina or Big Sur.
>> 
>> The traditional deployment approach bumps into lots of problems, starting 
>> with /System being very R/O, new Apache, etc. I've tried to find a page 
>> explaining howto, but in vain.
>> 
>> Did someone succeed to deploy on a current macOS? What's the easiest way to 
>> do that? (Load and security requirements are very low, for this case, I can 
>> accept a solution which works, even if it is slow/unsecure.)
>> 
>> Thanks a lot,
>> OC
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
>> 
>> This email sent to jtay...@oeinc.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: macOS deployment?

2021-04-30 Thread ocs--- via Webobjects-dev
Jesse, Ted,

> On 30. 4. 2021, at 16:38, Jesse Tayler  wrote:
> It’s not an ecosystem, it’s a container.
> You contain your entire deployment and this makes it portable so that it acts 
> the same on your desk as as it does on the cloud or anywhere else the 
> container runs.

That's not what I need by far. All I need is to make a WO app or two to run on 
a Catalina/Big Sur.

> What is it you need for deployment specifically? Or, why is running the app 
> at your desk insufficient?

So that is runs 24/7, auto-launches upon restart or crash, as wotaskd normally 
ensures. So that I can access it from other computers in my LAN through Apache 
without having to open the port the application runs on at all the firewalls.

On 30. 4. 2021, at 17:04, Ted Petrosky  wrote:
> I don't know why someone wants to keep reinventing the wheel for local 
> testing or for a local deployment

Quite the contrary — I'd like to simply use my old, well-tested and reliable 
wheel of just lauchning JavaMonitor, setting up all the things precisely the 
same way I do for the last quarter of century, without re-inventing anything 
and without being forced to learn new ecosy container things and their 
management. The only problem is, the deployment site where I do it all the time 
runs OSX 10.6; none of my home computers does (nor can, triple alas — it was 
the last really decent OSX release).

I guess for my limited needs (which do not contain load balancing nor other 
extra stuff) I could rig it myself, setting up a LaunchAgent plist to ensure 
the app to keep running, manually open up the ports both on the Mac and on my 
router as needed so that it can be reached from whole LAN through its WOPort 
etc.; just I naïvely though the old wheel would be ways easier than that.

Thanks and all the best,
OC

> 
>> On Apr 30, 2021, at 10:13 AM, o...@ocs.cz wrote:
>> 
>> Jesse,
>> 
>>> On 30. 4. 2021, at 15:50, Jesse Tayler  wrote:
>>> I’ve been using Docker which of course, contains the whole thing quite 
>>> nicely for this sort of portability
>> 
>> Thanks!
>> 
>> Nevertheless, I regret to say I never ever heard of the Docker thing so far. 
>> Of course I can just open docker.com and start learning a whole new 
>> ecosystem, but frankly, I don't need any other great services it might 
>> offer; all I need is simply to deploy a couple of apps, and learning a whole 
>> new environment seems a bit steep price for that — is that the only way?
>> 
>> Or perhaps it would really help if there was a document “how to set up and 
>> deploy a WO application through Docker on Big Sur/Catalina 101 for complete 
>> dummies who more or less understand WO, JavaMonitor etc., but know zilch of 
>> Docker“. Is there something like that? I've tried to find one, but in vain 
>> (there seem to be similar things for Tomcat and Azure and whatsnot, there's 
>> even a “docker-webobjects-wotaskd” on github without seemingly any 
>> documentation... perhaps self-evident for people who understand Docker, but 
>> I've no idea :/ )
>> 
>> Thanks a lot,
>> OC
>> 
>>> 
>>>> On Apr 30, 2021, at 9:49 AM, ocs--- via Webobjects-dev 
>>>>  wrote:
>>>> 
>>>> Hi there,
>>>> 
>>>> for my own local testing purposes, I would need to deploy a couple of WO 
>>>> apps locally on a macOS, Catalina or Big Sur.
>>>> 
>>>> The traditional deployment approach bumps into lots of problems, starting 
>>>> with /System being very R/O, new Apache, etc. I've tried to find a page 
>>>> explaining howto, but in vain.
>>>> 
>>>> Did someone succeed to deploy on a current macOS? What's the easiest way 
>>>> to do that? (Load and security requirements are very low, for this case, I 
>>>> can accept a solution which works, even if it is slow/unsecure.)
>>>> 
>>>> Thanks a lot,
>>>> OC
>>>> 
>>>> ___
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
>>>> 
>>>> This email sent to jtay...@oeinc.com
>>> 
>> 
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: again, merge on unlock did not happen :/

2021-10-14 Thread ocs--- via Webobjects-dev
Samuel,

thanks for a reply!

> This is probably a bug in the change propagation

Indeed. I am seeking for its source and for a work-around to render the bloody 
thing harmless :)

> Do you use EOEditingContext with long life span

I do. As I wrote, mostly (and far as this particular problem goes, exclusively) 
I use session default ECs.

> My experience is short life is much better


I do believe a complete re-write of the application could help, either using 
transient ECs as you suggest, or going even further and assign each session its 
own OSC and sync manually, as Chuck suggested some time ago; but I am afraid I 
can't quite afford that at the moment. The application is big and contains lots 
of legacy code.

At this moment, I would really appreciate a suggestion why the 
merge-upon-unlock might not happen properly. Are there any known scenarios to 
trigger that?

So far, I've found only one such a case — if the change notification happens 
during a save, pure WO/EOF would simply ignore it (wow!) Nevertheless I am 
using (my own subclass of) Wonder ERXEC, and this very problem should be fixed 
by the “bugfix from Lenny Marks”, which stores save-time notifications and 
re-posts them when save is done. Is there another similar problem perhaps, of 
which I do now know?

Thanks and all the best,
OC

> On 12. 10. 2021, at 1:26, Samuel Pelletier  wrote:
> 
> Hi OC,
> 
> This is probably a bug in the change propagation. Do you use EOEditingContext 
> with long life span (in Session for example) or short life one (in component 
> and task) ?
> 
> My experience is short life is much better. At least, you are sure your EOs 
> will reflect the latest snapshot when created in a new EOEditingContext. 
> Creating an EO from an EOGlobalID is very fast when the snapshot is in the 
> OSC (using localInstanceOf for example).
> 
> I hope this may help,
> 
> Samuel
> 
> 
>> Le 7 oct. 2021 à 04:02, OCsite via Webobjects-dev 
>> mailto:webobjects-dev@lists.apple.com>> a 
>> écrit :
>> 
>> Hi there,
>> 
>> I am again here with a mysterious bug; something like this happened before 
>> (with slightly different setup), now it happened again. This time the 
>> attributes involved were NSTimestamps; I (might be wrong, but I) believe the 
>> attribute type is irrelevant to the problem and I am re-writing it below 
>> with strings for clarity. Happened under a non-trivial load, nevertheless, 
>> especially during the step (ii) below, nothing of importance happened in any 
>> other thread (one unlocked its EC, none other logged anything at all). 
>> Single OSC, single instance, no background threads (all the things below 
>> were normal R/R workers), nothing fancy at all.
>> 
>> The problem, cleaned up for clarity, looks like this:
>> 
>> (i) eoX.foo=="old", eoX.bar=="ok"; two session default ECs -- let's call 
>> them ecC[hanger] and ecO[bserver] -- have eoX in their registeredObjects
>> 
>> (ii) two intertwined threads do these operations in this order:
>> - ThrO: ecO.lock
>> - ThrC: ecC.lock
>> - ThrC: eoX.foo="new" (in ecC)
>> - ThrO: ecO changes other EOs which are not important for us; does not touch 
>> eoX at all
>> - ThrC: ecC.saveChanges (eoX.foo properly saved into DB as "new")
>> - ThrO: ecO.saveChanges (other EOs properly saved, no change of eoX, which 
>> is OK)
>> - ThrC: ecC.unlock
>> - ThrO: ecO.unlock
>> 
>> (iii) repeatedly happen these operations:
>> - ecO.lock
>> - ecO changes other EOs which are not important for us, never touches eoX
>> - ecO.saveChanges (other EOs properly saved, no change of eoX, which proves 
>> eoX was never in ecO.updatedObjects)
>> - ecO.unlock
>> 
>> (iv) after a while, eoX in ecO is used conceptually like this:
>> - ecO.lock
>> - if (eoX.foo=="old") eoX.bar="stale"
>> - ecO.saveChanges (saves into DB eoX.foo as "old" and eoX.bar as "stale")
>> 
>> Can you see any possible reason why on earth eoX.foo=="new" was not merged 
>> into ecO as a side-effect of its first (or any subsequent) lock in (iii)? 
>> Can you see any reasonable[1] way to prevent this kind of problems in future?
>> 
>> Alas creating a separate OSC for each session and syncing them manually is 
>> not really an option for me.
>> 
>> [1] I've considered to check all registeredObjects of any EC in each unlock, 
>> compare their values to the DB snapshot, if different, check whether they 
>> were locally updated in the EC, if not, (log a warning and) fix the local EC 
>> value from the snapshot. Does not seem to me reasonable though for (a) 
>> efficiency -- I fear it would take too much time -- and (b) a danger of 
>> unintended consequences (especially -- not only -- with unlocks during 
>> processing of the ObjectsChangedInStoreNotification I fear all hell would 
>> break loose if I try anything like that).
>> 
>> Thanks a lot,
>> OC
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com 

session/logged-in user valid for a specific component only?

2022-01-09 Thread ocs--- via Webobjects-dev
Hi there,

I've got a pretty old application, the standard structure: there's Session 
which (among others) contains a property currentUser containing the user who 
has logged in and in whose account changes are performed. There is an 
OCSComponent extends ERXComponent with generic component services (many of 
which depend on session and/or its currentUser), and all my components inherit 
this.

Now I've got a new request to allow a given user to connect to _one specific 
page_ in the application through a specific URL _without a login_ and do his 
work in that page.

I can easily generate appropriate URL for a direct action, which would set up a 
session and open the desired page, that's easy.

What I can't quite see is how to prevent the user to go elsewhere in the 
application (e.g., by manually editing the URL) and stay logged in. Is there 
some trick for that?

So far I could think of two solutions:

(i) add a property allowedPage to Session, and in my direct action set it up 
appropriately. Then in the shared component awake at OCSComponent level I could 
check whether this==allowedPage and log out the user if not.

This looks like a good solution, but I am not entirely sure whether I am not 
overlooking some tricky way the user still might stay logged in and get to 
another page (without its awake performed)... is it completely safe?

(ii) write a complete new page code (ERXComponent-based, skipping OCSComponent 
altogether) for the specific page, which would contain and use its own 
component-level currentUser. The direct action would set this up and leave 
session.currentUser empty.

This is self-evidently completely safe, but a _lot_ of legwork :/

Can you see another, better solution? Or can you see that (i) is indeed safe 
enough?

Thanks and all the best (especially happy and successful new year),
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Wrong SQL when joining in an OR-part of the qualifier

2022-02-13 Thread ocs--- via Webobjects-dev
Hi there,

lately, I am encountering wrong fetches (with FrontBase, if important). I log 
out my qualifier and SQL, and the gist of the problem is a join in the OR-part 
of the qualifier. I want to fetch rows where there's an empty attribute, OR 
when there's a specific join:

06:52:06.510 DEBUG -> ((savedPresentationEndDate = null) or 
(lastValidPriceOfferCache.user = (model.DBUser)'[rc/Registration 
centre#104]'))

Alas, SQL-level, it boils down to something entirely different:

06:52:06.535 DEBUG "DBAuction"@318794136 expression took 1 ms: SELECT ... FROM 
"T_AUCTION" t0, "T_PRICE_OFFER" T1 WHERE (T1."C_CREATOR_ID" = 104 OR 
t0."C_PRESENTATION_END_DATE" is NULL) AND t0."C_LAST_VALID_PRICE_OFFER_CACHE" = 
T1."C_UID"

The SQL generator properly sets up the OR checking the right target PK, but 
then, instead of placing the join into the OR-part where it belongs to, it 
forces the join absolute to the entire condition — even to the NULL-check which 
should be completely independent.

That self-evidently is not what I need here: if t0."C_PRESENTATION_END_DATE" is 
NULL, I want to fetch the row regardless of whatever vaue there is or is not in 
the C_LAST_VALID_PRICE_OFFER_CACHE foreign key. Actually, if there happens to 
be NULL in C_PRESENTATION_END_DATE, I would prefer if the SQL-level would not 
try to join at all, for it is self-evidently superfluous. I've tried manually

SELECT * FROM "T_AUCTION" t0, "T_PRICE_OFFER" T1 WHERE 
(t0."C_PRESENTATION_END_DATE" is NULL) OR (T1."C_CREATOR_ID" = 104 AND 
t0."C_LAST_VALID_PRICE_OFFER_CACHE" = T1."C_UID")

which is what, I  believe, the SQL generator should have created from the 
qualifier, and it seems to work (at least, it produces no error; I cannot 
easily check whether the rows returned are OK. but they seem to t the first 
look).

Can perhaps anybody see how to fix the problem? (But for by generating directly 
my SQL at the application level, which I can do if need be, but would rather 
not, unless really the only way.)

Thanks,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


deletion of objects in relationships?

2022-02-25 Thread ocs--- via Webobjects-dev
Hi there,

lately, I was for the first time in a quarter of century of working with WO/EOF 
bitten in my tender parts by the following scenario:

- there's a 1:N relationship
- one of its objects is deleted using the plainest 
“eo.editingContext().deleteObject(eo)” approach
- which deletes the object all right, but _keeps the relationship snapshot 
EODatabase-level unchanged_
- thus, if now e.g., another user logs in and uses the relationship, he gets 
(from the snapshot, presumed his EC has old enough fetch timestamp) a list of 
gids containing one for the non-existing object, leading to 
“ObjectNotAvailableException: No  found with globalID ”

Until now, I've naïvely thought EOF would solve all such problems automagically 
inside of the saveChanges code (i.e., that among many other things, if a 
deleted object is part of a relationship, it gets automatically and properly 
removed; snapshot-level immediately upon save, in all the ECs later when they 
process the appropriate notification). So far it seemed to actually happen, 
always and reliably. Weird.

Looks like in fact this does _not_ happen, but I _do_ wonder. While the natural 
fix of course is to remove the object from the relationship(s) first (e.g., 
through removeObjectFromBothSidesOfRelationshipWithKey), and only then delete 
it (unless the relationship happens to be owning, in which case the deletion is 
not needed and happens automatically), there are _many_ cases where this 
approach could lead to problems, e.g.,

(i) objects which could be part of _many_ different relationships. Should we 
really manually remove the object from _all of them_ before we delete it?

(ii) what about relationships without an inverse? While EOF might be able to 
track internally those which (a) contain a given object, (b) and are in 
snapshots, and clean them up upon object deletion, I can't see any reasonable 
way to do that from the application-level code;

(iii) what if the app is being improved, and an already existing object is 
added into a new relationship? That object might be deleted for years through 
ec.deleteObject (or a plethora of other means, like WODisplayGroup, 
you-name-it). With a big legacy project it well might get next-to-impossible to 
find all such places. How do we ensure all the relationship snapshots which 
might contain the deleted object are properly cleaned up?

How do you solve this kind of problems?

And one bonus question: how comes the problem is rare enough that I've never 
bumped to it until now? Far as I understand, when one deletes objects using 
ec.deleteObject (I do most times), and when those objects are part of 
relationships (many of them are), it should be pretty common. It is not, for 
whatever reason.

Thanks for any insight,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: deletion of objects in relationships?

2022-02-26 Thread ocs--- via Webobjects-dev
Ha! Indeed, thanks a lot: having added extra logs I've found what I stupidly 
overlooked for a long long time, i.e., that I've switched relationships and 
have set Nullify for the one which does not have an iverse, and NoAction to the 
one which does. That explain essentially all the problems.

(Hm, I guess I should learn to set Nullify for no-inverse ones as well, to keep 
at the safe side. Far as I can say it is completely harmless, it just feel... 
improper, sorta :))

Thanks a lot!
OC

> On 25. 2. 2022, at 23:15, Jesse Tayler  wrote:
> 
> Definitely test your delete rules. Sounds like you just forgot to properly 
> set delete rules on the relationship
> 
>> On Feb 25, 2022, at 2:50 PM, ocs--- via Webobjects-dev 
>>  wrote:
>> 
>> Hi there,
>> 
>> lately, I was for the first time in a quarter of century of working with 
>> WO/EOF bitten in my tender parts by the following scenario:
>> 
>> - there's a 1:N relationship
>> - one of its objects is deleted using the plainest 
>> “eo.editingContext().deleteObject(eo)” approach
>> - which deletes the object all right, but _keeps the relationship snapshot 
>> EODatabase-level unchanged_
>> - thus, if now e.g., another user logs in and uses the relationship, he gets 
>> (from the snapshot, presumed his EC has old enough fetch timestamp) a list 
>> of gids containing one for the non-existing object, leading to 
>> “ObjectNotAvailableException: No  found with globalID > deleted>”
>> 
>> Until now, I've naïvely thought EOF would solve all such problems 
>> automagically inside of the saveChanges code (i.e., that among many other 
>> things, if a deleted object is part of a relationship, it gets automatically 
>> and properly removed; snapshot-level immediately upon save, in all the ECs 
>> later when they process the appropriate notification). So far it seemed to 
>> actually happen, always and reliably. Weird.
>> 
>> Looks like in fact this does _not_ happen, but I _do_ wonder. While the 
>> natural fix of course is to remove the object from the relationship(s) first 
>> (e.g., through removeObjectFromBothSidesOfRelationshipWithKey), and only 
>> then delete it (unless the relationship happens to be owning, in which case 
>> the deletion is not needed and happens automatically), there are _many_ 
>> cases where this approach could lead to problems, e.g.,
>> 
>> (i) objects which could be part of _many_ different relationships. Should we 
>> really manually remove the object from _all of them_ before we delete it?
>> 
>> (ii) what about relationships without an inverse? While EOF might be able to 
>> track internally those which (a) contain a given object, (b) and are in 
>> snapshots, and clean them up upon object deletion, I can't see any 
>> reasonable way to do that from the application-level code;
>> 
>> (iii) what if the app is being improved, and an already existing object is 
>> added into a new relationship? That object might be deleted for years 
>> through ec.deleteObject (or a plethora of other means, like WODisplayGroup, 
>> you-name-it). With a big legacy project it well might get next-to-impossible 
>> to find all such places. How do we ensure all the relationship snapshots 
>> which might contain the deleted object are properly cleaned up?
>> 
>> How do you solve this kind of problems?
>> 
>> And one bonus question: how comes the problem is rare enough that I've never 
>> bumped to it until now? Far as I understand, when one deletes objects using 
>> ec.deleteObject (I do most times), and when those objects are part of 
>> relationships (many of them are), it should be pretty common. It is not, for 
>> whatever reason.
>> 
>> Thanks for any insight,
>> OC
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
>> 
>> This email sent to jtay...@oeinc.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


model validations

2022-03-13 Thread ocs--- via Webobjects-dev
Hi there,

for once, I am not here with a problem... well not with a problem in my WO 
application :)

Thing is, I am just implementing model validations, and I would be grateful if 
anyone of you would check my list below and let me know if you can see any 
other reasonable validation which I should add to it, to make working with 
models safer and decrease the probability of potential problems. Or, if you 
consider one of the checks below stupid :)

Any object:
- name must be non-empty valid identifier (actually I don't know: _might_ there 
be eg. an attribute name “123” or even “hi there”? Self-evidently relationship 
names can't contain dots, far as they could be used for flattening... Anyway 
I've never seen in any model such an exotic name, and am not willing to allow 
those in my models :))

Model: no validations I could think of (there are things like unique entity 
names, but they seemed to be better done entity-level, see below)

Entity:
- name must be unique in the model group
- if the class is a generic one, should be the right one preset for project 
(could be EOGenericRecord or er.extensions.eof.ERXGenericRecord or project's 
own, but I believe they should be consistent for a project)
- table name must be non-empty and SQL-valid
- primary key may not be empty

Relationship:
- name must be unique amongst all entity properties
- join semantic and deletion rule must be either empty, or contain one of the 
supported names

- if flattened
-- definition must be valid (ie. all parts proper and existing relationships in 
appropriate entities which properly chain)
-- joins array must be empty
-- destination entity must be empty
-- if any of the parts is :N, the flattened one must be :N too; if not, must be 
:1
-- I feel here should be more checks. For one, I don't think PK propagation can 
be ever valid on a flattened rel (or can it?) Flattened, I think, can never 
contain another flattened one, or can it? Can you see other validations?

- if not flattened
-- destination must be a name of an existing entity in model group

-- if propagates PK
--- there can't be a PK-propagation loop leading to the same entity
--- optional warning if not owning (that is valid, but far as I can say, does 
not make really sense. Or does it?)
--- error if the target is not a PK

-- if the target entity looks like an M:N intermediate table (generic, all 
attrs PKs, exactly two :1 relationships)
--- warning if the rel is :N (again, I believe this is valid, but does not make 
sense in any sane model; do I overlook something?)
--- if it does not own destination (dtto)
--- if it does not propagate PK (dtto)
--- if it does not cascade delete (dtto)

-- error if there are no joins or invalid join names (for which there is no 
attribute)
-- error if if the source and destination type for joins differ
-- error if if the type is BOOLEAN (I believe all other database types can be 
used for joins, although some, eg. TIMESTAMPs, would be rather unusual)
-- optional warning if source attribute of :N is not a PK (valid, but does not 
make sense in any sane model; do I overlook something?)
-- error if target attribute of :1 is not a PK (and also if the joins do not 
contain a complete target PK)
-- warning if the mandatory switch of relationship and the allows null switch 
of its source attribute do not match
-- warning if :1 PK -> PK is not owning or does not cascade delete (again, 
valid, but nonsense far as I can say)
-- error if the deletion rule of an owning relationship is nullify (which makes 
sense) or cascade (which does not IMHO, but Apple decided so :))
-- warning if the deletion rule is NoAction and there is an inverse relationship

Attribute:
- name must be unique amongst all entity properties
- class name must be non-empty and valid, plus optional check whether it is one 
of supported class names (NSString, NSNumber, NSDecimalNumber, NSCalendarDate, 
NSData)
- optional check whether the value type is valid for the selected class name

- if the attribute is a primary key
-- it must have an empty definition
-- it must be used for locking
-- it may not allow null
-- optionally a warning if it is a class property (definitely valid, but 
indicates a bad design I believe)

- if there is no definition at all
-- the external type must be nonempty, plus optional check whether it is one of 
types supported by the database used for the model in the project
-- the external type and value type should match the class name
-- the column name must be non-empty and valid
-- I wonder, should I enforce unique columns? Frankly I do not know whether two 
attributes addressing both the same DB column even make a valid model or not.

- if there is a non-empty definition
-- that both external type and column name are empty

-- if the non-empty definition does not make a proper flattened attribute (ie. 
the attr is derived)
--- whether the attribute is read-only
--- whether it is not used for locking

-- if the definition makes a proper flattened a

Duplicated PK

2022-07-26 Thread ocs--- via Webobjects-dev
Hi there,

again I've bumped into a pretty darn weird behaviour.

All my PKs are INTs, all generated by EOF (occasionally through 
rawPrimaryKeyInTransaction, most times — and unless I am overlooking something, 
*all the times* in the problem described below, the most usual way, simply as a 
side-effect of a save).

One of my entities has a DB constraint which makes sure its auctionSeq 
attribute stays unique. There's the following code to keep it so (simplified 
for better readability):

===
def mySaveChanges(ec) {
try {
ec.saveChanges()
} catch (EOGeneralAdaptorException e) {
ec.rootObjectStore.lock() // possibly superfluous at this moment, can't 
harm
String emsg=e.localizedMessage, 
cname='UNIQUE_AUCTION_SEQ_CONSTRAINT_NAME(C_AUCTION_SEQ=' // incidentally, is 
there a better way to recognise a constraint? This is UGLY (but works OK)
if (emsg.indexOf(cname)<0) throw // another problem, let's fail saving
def failedauction=ec.registeredObjects.find { it instanceof DBAuction }
++failedauction.auctionSeq
mySaveChanges(ec) // let's try again with an incremented seq
ec.rootObjectStore.unlock()
}
}
===

It very rarely happens that the code is actually needed, but it is possible 
e.g., if two users create auctions concurrently. Today, it happened -- 
strangely enough, only one user created auction, but some dumb tester left 
auctions with nonsensical seqs (much higher than the current value at the time) 
in the DB long long ago, and we just have bumped into them today.

The code above worked perfectly, there were two bad test auctions (say, with 
seqs 2766 and 2767, with the current seq just reaching 2766), their seqs were 
skipped all right, newly created auction was stored without a glitch with the 
proper unique seq 2768 and a new PK, say, 1012857. So far so good.

*But* five minutes later, the user created another new auction. There was 
absolutely no problem app-side, the newly created action got new unique seq 
2769, but EOF assigned to it *again* the same PK, 1012857! Of course, save 
failed.

The user logged out, logged in, and this time in new session and new EC created 
the new auction all right, seq 2769, PK 1012858, all well and swell.

Couple of minutes later, another user, logged in for hours, tried to create a 
new auction is his independent session with a different EC, and *again* got PK 
1012857 (and of course, save failed)! He did not try again.

Can perhaps anyone see a possible culprit? Thanks!
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


JSConfirmPanel vs file download?

2022-08-31 Thread ocs--- via Webobjects-dev
Hi there,

bumped into a weird problem. I allow users to download a file, pretty standard 
code

===
WOActionResults downloadListing() {
WOResponse wor=new WOResponse()
wor.setHeader("application/pdf; 
name=\"Listing\"","content-type")
wor.setHeader("attachment; 
filename=\"Lisitng.pdf\"","content-disposition")
wor.setContent(... my data ...)
return wor
}
===
Get listing
===

This works like a charm. Nevertheless, the client wants to guard the download 
by a JS alert; and if I change the template to

===
Get listing 
===

I get this exception:

===
java.lang.ClassCastException: com.webobjects.appserver.WOResponse cannot be 
cast to com.webobjects.appserver.WOComponent
[2022-8-31 15:32:28 CEST]  java.lang.ClassCastException: 
com.webobjects.appserver.WOResponse cannot be cast to 
com.webobjects.appserver.WOComponent
at 
com.webobjects.woextensions.JSComponent.invokeAction(JSComponent.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
com.webobjects.woextensions.KeyValueCodingProtectedAccessor.methodValue(KeyValueCodingProtectedAccessor.java:32)
at 
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKeyValueCoding.java:1134)
at 
com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueForKey(NSKeyValueCoding.java:1324)
at 
com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1736)
at 
com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCoding.java:447)
at 
com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.valueForKeyPath(NSKeyValueCodingAdditions.java:212)
at 
com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:1804)
at 
com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java:50)
at 
com.webobjects.appserver._private.WOGenericElement.invokeAction(WOGenericElement.java:121)
at 
com.webobjects.appserver._private.WOGenericContainer.invokeAction(WOGenericContainer.java:27)
at 
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at 
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115)
at 
com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:1079)
... ... ...
===

How to fix the problem? Thanks!
OC
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Java 17? Half or Full?

2022-12-10 Thread ocs--- via Webobjects-dev
Hi there,

we are “Java 17 None At All”. For development, we use javas 1.8-11 (actually a 
couple years ago I've tried 12, bumped into some problems — can't recall 
details, too long ago — and from then up to now, I stick with 11 or lower). 
Deployment is mostly 1.8, but there's one ancient Xserve which still runs a 
couple of not-too-important internally-used applications on a 1.6 :)

All the best,
OC

> On 10. 12. 2022, at 16:36, Aaron Rosenzweig via Webobjects-dev 
>  wrote:
> 
> This is both a topic for both pure NeXT/Apple WO as well as a WOnder. 
> 
> Your WO deployments, are they on Java 17? Are they half or full Java 17? 
> Please chime in. 
> 
> In our case, at present, we are developing and deploying on a Java 17 VM but 
> using Java 1.8 (version 8) compliance. I call this “Java 17 Half"
> 
> Definitions:
> Java 17 Half -> Developing and deploying on Java 17 but using Java 1.8 
> compliance.
> Java 17 Full -> Not only using a Java 17 VM but also targeting v17 compliance 
> and using JPMS (Java Package Management System) which was introduced with 
> Java 9. 
> 
> PHB -> “So I was golfing with my buddies and found out they are all using 
> Java 17 *sealed* classes. This is so cool and will revolutionize our 
> codebase. I want you to start using it immediately. It was introduced with 
> Java 17. I’m so glad we are on a 17 VM.” 
> 
> Me -> “Can’t do it”
> 
> PHB -> “Why not? You told me we went to Java 17 over a year ago.”
> 
> Me -> “We did and are on Java 17, but we compile for Java 1.8”
> 
> PHB -> “That’s no good. We need to be fully modern. We need to be able to use 
> new constructs as they emerge. Why are we compiling for Java 1.8 ? Is it a 
> problem with WOnder?”
> 
> Me -> “Because our core frameworks are closed source, from NeXT/Apple, our 
> hands are somewhat tied. That’s part of the problem. The other part is that 
> class loading changed dramatically with Java 9 onward and broke a lot of 
> things for many people. Because we leverage so much from Apple and WOnder, we 
> pretty much are stuck. Our frameworks are stuck in java 8 compliance and 
> therefore so are we” 
> 
> Definitions:
> Old Class loader -> Java 1.8 (version 8) and older. 
> New Class loader -> Java 9 and newer. 
> 
> The new class loader tries to avoid “Jar Hell” but that’s something we 
> actually enjoyed about the old class loader. What Oracle saw as a weakness 
> and sought to fix, Sun saw as a strength. It’s causing us trouble right now 
> with going Java 17 Full. Here’s an example. 
> 
> Consider a jar named “animals_v1.jar” that has classes for birds and other 
> creatures. Imagine that there is also a newer “animals_v2.jar” Let me diagram 
> them below in pseudocode:
> 
> animals_v1.jar:
> com.acme.Duck.speak()
> 
> animals_v2.jar:
> com.acme.Duck.speak()
> com.acme.Duck.hasFeathers()
> 
> Suppose you are using the old class loader and somehow had both jars in your 
> class path. It matters which jar is first because the first one wins when 
> there are multiple definitions in the class path for “com.acme.Duck”. You 
> could have a situation where things compile but at runtime there’s a failure 
> because we can’t ask “hasFeathers()” and it’s situations like these that 
> Oracle considered a design flaw or “Jar Hell.” 
> 
> In our case, we considered this functionality of the old class loader a 
> strength. As long as we are careful, we can avoid the pitfalls but also do 
> clever patching of closed source Apple frameworks like so:
> 
> Apple java frameworks:
> com.apple.NSArray
> 
> WOnder java frameworks:
> com.apple.NSArray
> 
> By putting WOnder’s frameworks first in the class path, and being careful to 
> not remove needed functionality of NSArray, we can “overwrite” Apple's 
> implementation with an improved one while letting the rest of Apple’s code 
> work directly with our NSArray replacement. Unfortunately this breaks the new 
> class loader. It’s not allowed. Cannot have NSArray defined in more than one 
> named place. Even if we take WOnder out of the equation, we still have 
> problems with Apple’s JavaXML framework where it redefines W3C and DOM 
> objects that java.xml named module natively defines in modern Java. 
> 
> If we want to compile for modern java on new VMs what can we do? I’m no 
> expert, so correct me if I’m wrong, but I’m trying to make sense of what our 
> options are. There is no easy path. There is no set of simple VM arguments or 
> anything magic that takes a small amount of effort. We’d have to do something 
> like TreasureBoat where we take ownership of the private libraries. We can’t 
> surgically replace a few objects in the private libraries anymore by class 
> path ordering and I don’t think Aspect-Oriented Programming nor Dependency 
> Injection can save us here either. We also now have conflicts in pure Apple 
> libraries with what is currently built-into Java. 
> 
> How long are we ok using modern VMs but compiling for 1.8? “OK” meaning 
> functional but not allowed to

choosing the submit for Enter in a textfield?

2023-03-26 Thread ocs--- via Webobjects-dev
Hi there,

I've got a form (combined from more separate components) whose overall layout is

 
  ... lots of inputs incl. a number of textfields ...
  
  
  
  ... other inputs and textfields ...
  


I would need that an Enter in the "bar" textfield triggers "barAction"; an 
Enter in any other textfield triggers "fooAction".

Can this be done in a clean, preferably non-JS way?

I've found that I can put an invisible submit/fooAction at the place of [1], in 
which case _all_ Enters in _all_ textfields trigger "fooAction", but I haven't 
been able to find any nice way to ensure an Enter in the "bar" textfield 
triggers "barAction". With JS, I can do that, but it is really darn ugly (and 
besides it wouldn't work if the user switches off JS for security).

Thanks a lot!
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: choosing the submit for Enter in a textfield?

2023-03-28 Thread ocs--- via Webobjects-dev
Jesse,

> On 28. 3. 2023, at 15:48, Jesse Tayler  wrote:
> Did you try Ajax?

Nope. Will try, thanks!

> It’s reasonably simple to wrap things individually but I try to keep my forms 
> simple wherever possible so I’m not at all certain about the results you’re 
> after

We, alas, have rather complex editor forms, combined from a number of nested 
components at that. Perhaps they might be easier with Ajax, and perhaps my 
reluctance using JS unless there's no other reasonable way to solve the task 
does not make much sense anymore — I am told today the number of users who 
switch the thing off is very small and decreasing...

Thanks and all the best,
OC

>> On Mar 28, 2023, at 9:31 AM, OCsite via Webobjects-dev 
>>  wrote:
>> 
>> René,
>> 
>>> On 28. 3. 2023, at 14:23, René Bock >> <mailto:b...@salient-doremus.de>> wrote:
>>> I guess the only non JS solution would be to split the form in two 
>>> different forms.
>> 
>> Thanks, but since the layout is
>> 
>> [some form 1 items]
>> [complete form 2]
>> [other form 1 items]
>> 
>> I don't think I can do that. Perhaps if I could add the “form” attribute to 
>> the form 2 inputs it might work; but far as I know, with standard WO/nder 
>> inputs and submits that is not possible (or is it?), and although I could 
>> write my own ones, well, it's still easier to use the darned JS :)
>> 
>> Thanks and all the best,
>> OC
>> 
>>>> Am 26.03.2023 um 23:05 schrieb ocs--- via Webobjects-dev 
>>>> mailto:webobjects-dev@lists.apple.com>>:
>>>> 
>>>> Hi there,
>>>> 
>>>> I've got a form (combined from more separate components) whose overall 
>>>> layout is
>>>> 
>>>>  
>>>> ... lots of inputs incl. a number of textfields ...
>>>> 
>>>> 
>>>> 
>>>> ... other inputs and textfields ...
>>>> 
>>>> 
>>>> 
>>>> I would need that an Enter in the "bar" textfield triggers "barAction"; an 
>>>> Enter in any other textfield triggers "fooAction".
>>>> 
>>>> Can this be done in a clean, preferably non-JS way?
>>>> 
>>>> I've found that I can put an invisible submit/fooAction at the place of 
>>>> [1], in which case _all_ Enters in _all_ textfields trigger "fooAction", 
>>>> but I haven't been able to find any nice way to ensure an Enter in the 
>>>> "bar" textfield triggers "barAction". With JS, I can do that, but it is 
>>>> really darn ugly (and besides it wouldn't work if the user switches off JS 
>>>> for security).
>>> 
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
>> 
>> This email sent to jtay...@oeinc.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


action in a sub-component?

2024-04-26 Thread ocs--- via Webobjects-dev
Hi there,

I've got a sub-component which uses performParentAction; the appropriate 
binding is something like . Works 
perfectly.

Purely for aesthetic reasons (and, well, for consistency), I would prefer if I 
could use the sub-component precisely same way one uses wo:hyperlink, i.e., 
like this: 

Is there a trick to achieve that? Looks like in this case when I try 
valueForBinding('action'), I get NULL :(

Thanks,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: action in a sub-component?

2024-04-26 Thread ocs--- via Webobjects-dev
Hugi,

thanks, works like a charm!

(So far I bumped into no problem without setCurrentComponent( parent() ). 
Somewhat weird, but well, far as it works... :))

Thanks and all the best,
OC

> On 26. 4. 2024, at 22:19, Hugi Thordarson via Webobjects-dev 
>  wrote:
> 
> I've never done this, but it's such a nice brain-teaser I had to try :). And 
> what I did _seems_ to work.
> 
> https://gist.github.com/hugithordarson/37d03336de17cfcf3ac399f6325e0ff2
> 
> The key is making the child component non-synchronizing, otherwise the parent 
> action will get invoked during the pulling of binding values. And it should 
> be quite OK if the action method returns null, that just means the same as 
> returning null from any action invocation, i.e. "I'm working within and 
> returning the current page instance".
> 
> I'm thinking… It kind of feels like one would have to setCurrentComponent( 
> parent() ) in the child before performing the action invocation and then 
> reset it back to itself afterwards (since we're really invoking an action 
> within the context of the parent component), but I might be wrong, this seems 
> to work without it.
> 
> Cheers,
> - hugi
> 
> 
> 
>> On Apr 26, 2024, at 19:47, ocs--- via Webobjects-dev 
>>  wrote:
>> 
>> Hi there,
>> 
>> I've got a sub-component which uses performParentAction; the appropriate 
>> binding is something like . Works 
>> perfectly.
>> 
>> Purely for aesthetic reasons (and, well, for consistency), I would prefer if 
>> I could use the sub-component precisely same way one uses wo:hyperlink, 
>> i.e., like this: 
>> 
>> Is there a trick to achieve that? Looks like in this case when I try 
>> valueForBinding('action'), I get NULL :(
>> 
>> Thanks,
>> OC
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is
>> 
>> This email sent to h...@karlmenn.is
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/ocs%40ocs.cz
> 
> This email sent to o...@ocs.cz

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: re/store context somehow? (OCsite)

2024-05-18 Thread ocs--- via Webobjects-dev
Thanks a lot, also to all others!

> On 18. 5. 2024, at 4:06, Paul Hoadley via Webobjects-dev 
>  wrote:
> On 18 May 2024, at 6:26 am, Amedeo Mantica via Webobjects-dev 
> mailto:webobjects-dev@lists.apple.com>> 
> wrote:
>> I no longer use WO but I recall this framework in wonder: 
>> ERPersistentSessionStorage
> 
> That framework is a fantastic proof of concept, but in practice the approach 
> can be quite brittle. It works by Java-serializing the object graph rooted at 
> the WOSession, so if any object in that graph isn't serializable, it's game 
> over for that session. By all means try it out, but in our experience (and 
> we've sunk many hours into experimentation with it), it works brilliantly 
> right up until it fails spectacularly.

Hmmm... can you recall please some scenarios, which lead to the spectacular 
failure?

Based on the ER source code and some Ramsey suggestionst (thanks again!) I've 
found a way which so far, tested just for a short time only at my side, seems 
to work reasonably well — here's the gist, without error checking, logging and 
other cosmetics:

===
class OCSSession extends ERXSession {
WOContext lastContext
void sleep {
if (context.page) lastContext=context.clone()
super.sleep()
}
}

class OCSDirectAction extends ERXDirectAction {
WOActionResults restorePreviousStateAction {
Session ss=session()
if (ss.lastContext) { // code essentially stolen from ERD2WDirectAction
String cid=ss.lastContext.request.stringFormValueForKey('__cid')
if (cid) return ss.restorePageForContextID(cid)
if (ss.lastContext.page) return ss.lastContext.page
}
pageWithName(MainPage.class.name)
}
}
===

If you can foresee case(s) when it would fail, I'd be grateful for some hints, 
so that I test them here and update my code appropriately.

Thanks again and all the best,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext

2024-06-07 Thread ocs--- via Webobjects-dev
Hi there,

again in about 2 years the $subject did happen:

“Cannot obtain globalId for an object which is registered in an other than the 
databaseContext's active editingContext, object: 
[USER#1000175@EC:34ea315d/OSC:77b7ffa4], databaseContext: 
com.webobjects.eoaccess.EODatabaseContext@512d92b, object's editingContext: 
EC:34ea315d/OSC:77b7ffa4, databaseContext's active editingContext: 
EC:7de5b11a/OSC:77b7ffa4“

(ECs are my subclasses which log out the appropriate OSC, too; did that when 
I've hunted for bugs in multi-OSC environment. Unimportant here, in this case 
all OSCs are same.)

Again, as before, the cause were the changes previously stored for later in 
another EC (since when they actually happened, the EC was locked). The 
important stack items (far as I can say) are here (full stack at the end of the 
message, should it help):

- EODatabaseContext._globalIDForObject(EODatabaseContext.java:4660) # failed, 
since this._editingContext=EC:7de5b11a, object.editingContext=EC:34ea315d
- EOCustomObject.includeObjectIntoPropertyWithKey(EOCustomObject.java:904) # 
pretty sure both were in the same EC, 34ea315d
- EOEditingContext._processNotificationQueue(EOEditingContext.java:4741) # 
should be EC:34ea315d, whose merge queue happens to be non-empty
- EOEditingContext._globalIDChanged(EOEditingContext.java:2038) # EC:34ea315d 
received the notification and tries to merge stored changes
- EODatabaseContext.commitChanges(EODatabaseContext.java:6377) # 
postNotification "EOGlobalIDChangedNotification"
- 
EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:386)
 # EC:7de5b11a, normal save, happens to be a single insert, which is quadruple 
weird :-O (I believe a single insert actually should not trigger change 
merging?!?)

I've spent a cosy night over the logs and Wonder sources and the documentation 
etc., and found sweet nothing — I'm still not the slightest bit smarter than 2 
yrs ago :(

It seems to me that
(a) it is quite normal that during save of EC:A, any number of ECs:B,C,D... 
could be merging changes saved for later in their EOGlobalIDChangedNotification 
handlers
(b) which should, though, never ever happen while EC:A is set as the EODBC's 
active context — actually the contexts should be set properly for each the EC.

Can anybody perhaps see the possible culprit?

It really does not seem a cross-EC relationship can be the culprit. I might 
still overlook something, but I am pretty darn sure that the 
includeObjectIntoPropertyWithKey method has been called with both the receiver 
and object in the same EC, the one which was merging its previously stored 
changes, 34ea315d.

I am pretty sure the culprit was that at the moment this happened, the EODBC's 
active context was the one which did run the original save, 7de5b11a.

How the B.H. is that possible though?

Note: far as I can say with my logs, there happened to be *NO* thread 
concurrency at the moment, which makes it even more weird. Far as my logs say, 
no other thread did *anything* when my worker thread (a) saved a single simple 
insert in EC:7de5b11a, (b) which, as as side-effect, caused the EC:34ea315d to 
merge its previously saved changes, (c) which threw the exception as detailed 
above. Sigh.

On the other hand, a (successful, uneventful) save in EC:7de5b11a which _did 
change_ the very USER#1000175 object did happen _very shortly_ before (about 20 
ms before). In the same thread, in the same EC. I can't quite see how it can be 
important (far as I can say, there's no timer like “having saved X, merge 
changes to other ECs in couple of millis“ or so), but then, I still can be 
overlooking something of great importance.

Thanks a lot for any insight,
OC

=== full stack in case it helps (did not to me :/ )
Note please OCSEC is my own ERXEC subclass, which in this case does essentially 
nothing but logs out. Especially OCSEC._processObjectStoreChanges just logs (so 
that I know whether the merge happens or not, and if it does, with what data) 
and then calls super. Same with my own lock(), it does essentially nothing 
(first calls super and only then logs out, which in this case did not happen, 
for the exception happened inside of super.lock):

- EODatabaseContext._globalIDForObject(EODatabaseContext.java:4660)
- EODatabaseContext.databaseOperationForObject(EODatabaseContext.java:4767)
- EODatabaseContext.valuesForKeys(EODatabaseContext.java:6535)
- EOObjectStoreCoordinator.valuesForKeys(EOObjectStoreCoordinator.java:326)
- 
EOQualifierSQLGeneration$_KeyValueQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:439)
- 
ERXExtensions$KeyValueQualifierSQLGenerationSupport.schemaBasedQualifierWithRootEntity(ERXExtensions.java:661)
- 
EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:179)
- 
EODatabaseChannel.selectObjectsWithFetchSpecification(EODatabaseChannel.java:227)
- 
EODatabaseContext._objectsWithFetchSpecificationEditingC

[POSSIBLY SOLVED]: Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext

2024-06-08 Thread ocs--- via Webobjects-dev
Hi there again,

I was eventually able to repeat the problem and it sort of stinks by a bug in 
EOF (or I am doing something wrong, of course, as so often :)) My test code is 
just a wee bit at the convoluted side, based on my own model and besides 
written in Groovy, thus there's no point in quoting it; but the gist is this:

1. create an EC1, assign it a fetchTimestamp in future (something like 
System.currentTimeMillis()+1500 should suffice)
2. lock EC1
3. fetch into EC1 an object with a :N relationship and change that 
relationship, not saving the changes
4. wait until the fetchTimestamp expires
5. in a separate thread with its own EC2 (locked) change the same relationship 
of the same object (localInstanceIn(EC2) of course)
6. save the changes in EC2
7. back in the original thread, wait until the thread with steps 5 and 6 ends. 
Then unlock EC1
8. finally, in an unrelated EC3 insert some unrelated new object and 
saveChanges...

... and at least at my side, I get “Cannot obtain globalId for an object which 
is registered in an other than the databaseContext's active editingContext“ 
exception all right!

I believe the steps above are completely valid and should not cause problems, 
or do I overlook something here?

I might be wrong, it is a bit at the complex side, but I think this is what 
happens under the hood:
(i) EC3 saveChanges of step 8 just calls 
EOObjectStoreCoordinator.saveChangesInEditingContext ...
(ii) which first makes sure there's a proper source (happens to be 
EODatabaseContext) for each inserted object in its _sources; this 
EODatabaseContext happens to be the only shared EODatabaseContext a simple 
application like this one uses (no more OSCs, no concurrent DB access)
(iii) each _source gets _willPrepareForSave and then each _source gets 
prepareForSaveWithCoordinator — and this sets its _editingContext to EC3!
(iv) furthermore each _source gets recordChangesInEditingContext, 
performChanges, and eventually commitChanges
(v) inside of commitChanges, EODatabaseContext finds that some changes really 
happened and posts EOGlobalIDChangedNotification
(vi) EC1, which up to this moment was dormant, observes this notification and 
through _globalIDChanged, _sendOrEnqueueNotification, yadda yadda, eventually 
gets to merge the change into its own object
(vii) which change includes checking the current relationship value. Since the 
fetchTimestamp is already in the past, this involves re-fetching the 
relationship in EC1 ...
(viii) ... which goes through the one and only shared EODatabaseContext we 
have. That EODatabaseContext though still has its _editingContext set to EC3 
from the step (iii))!

Hilarity ensues, the “Cannot obtain globalId for an object which is registered 
in an other...” exception gets thrown (if this did not happen, the 
EODatabaseContext's _editingContext would get nulled at the very end of 
commitChanges, too late for us).

Do I overlook something of importance? Seems me not to; I guess anyone can 
repeat the test code 1-8 outlined above (just beware logs — they might fire the 
fault prematurely; also I've found essentially each localInstanceIn locks ECs 
and thus disrupts the normal processing — best to prepare all the ECs and all 
their local instances at the very start, around the step 1).

What would be the best fix/work-around? I can't see any simple one; and I would 
rather not override and re-implement the complete and rather non-trivial 
commitChanges method.

Thanks and all the best,
OC

> On 8. 6. 2024, at 4:38, ocs--- via Webobjects-dev 
>  wrote:
> 
> Hi there,
> 
> again in about 2 years the $subject did happen:
> 
> “Cannot obtain globalId for an object which is registered in an other than 
> the databaseContext's active editingContext, object: 
> [USER#1000175@EC:34ea315d/OSC:77b7ffa4], databaseContext: 
> com.webobjects.eoaccess.EODatabaseContext@512d92b, object's editingContext: 
> EC:34ea315d/OSC:77b7ffa4, databaseContext's active editingContext: 
> EC:7de5b11a/OSC:77b7ffa4“
> 
> (ECs are my subclasses which log out the appropriate OSC, too; did that when 
> I've hunted for bugs in multi-OSC environment. Unimportant here, in this case 
> all OSCs are same.)
> 
> Again, as before, the cause were the changes previously stored for later in 
> another EC (since when they actually happened, the EC was locked). The 
> important stack items (far as I can say) are here (full stack at the end of 
> the message, should it help):
> 
> - EODatabaseContext._globalIDForObject(EODatabaseContext.java:4660) # failed, 
> since this._editingContext=EC:7de5b11a, object.editingContext=EC:34ea315d
> - EOCustomObject.includeObjectIntoPropertyWithKey(EOCustomObject.java:904) # 
> pretty sure both were in the same EC, 34ea315d
> - EOEditingContext._processNotificationQueue(EOEditingContext.java:4741) # 
> should be EC:34ea315d, 

awake-time long lags

2024-08-01 Thread ocs--- via Webobjects-dev
Hi there,

we are encountering another weird problem: a (very) long lag awake-time.

We happen to log the application-level awake and some of the component-level 
awakes. Normally, the latter happen just a couple milliseconds from the former. 
Nevertheless _sometimes_ when the load gets higher and more R/R loops run 
concurrently, this lag grows up to a complete nonsense — tens or, in the worst 
cases, hundreds of seconds (between Application.awake and some Component.awake).

The most obvious answer that either the session-level awake or some of the 
non-logged component-level awakes might take an eternity upon a higher load is 
still an open possibility, but quite improbable one: we have profiled our 
application when the problem did happen with a smaller load, a couple of times 
the lag grew up to about 5-7 s, and still none of the awake methods ever took 
more than 40 ms.

Has perhaps anyone here encountered a similar problem and might suggest a 
solution or at least a reasonable way to find the culprit?

Thanks and all the best,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


weird locks in faultWithPrimaryKeyValue

2024-08-16 Thread ocs--- via Webobjects-dev
Hi there,

I've got a direct action, which sometimes needs to get an object with a known 
PK, for which I use faultWithPrimaryKeyValue. Works well for years, but lately 
the fetches went longer, so I decided to allow it to use a separate OSC not to 
clash with the normal database requests.

The result is weird:
- sometimes, faultWithPrimaryKeyValue in the dedicated OSC is lightning fast, 
as presumed
- sometimes though, it never ends?!? :-O

It does not lock once and then stay locked, the cases are intermittent. Also, 
it never locks when I test myself at my development machine; happens on the 
deployment site only, sigh. I have also reasons to believe that the DA does not 
deadlock with another thread (essentially since at the moment of the first 
lock, nothing at all ran in parallel).

The code looks like this:
===
static sharedosc
WOActionResults someAction() {
  try {
boolean oscpolicy=ERXProperties.booleanForKey('ActionSpecificOSC')
def localec, osc
... ...
for (... a couple of times ...) {
  ...
  if (some-condition-which-says-I-need-to-fetch) {
if (!localec) {
  if (oscpolicy && !sharedosc) sharedosc=new 
ERXObjectStoreCoordinator(true)
  
(localec=ERXEC.newEditingContext(sharedosc?:EOEditingContext.defaultParentObjectStore())).lock()
 // 1
}
log "/TEMP will fetch in $localec..." // 2
eo=EOUtilities.faultWithPrimaryKeyValue(localec ,'DBAuction', 
Integer.valueOf(map.eoprimarykey))
log "/TEMP ... did fetch in $localec"
  }
  ...
}
... ...
if (localec) localec.dispose()
  } catch (exc) {
some-log-which-never-happens-thus-I-know-the-above-never-threw
  }
}
===

When ActionSpecificOSC is off, it never ever locks. When it is on though, 
occasionally the “will fetch” log marked // 2 is the very last thing which the 
appropriate worker thread ever does. In other (intermittent) cases it all works 
well.

Aside of moving the localec.dispose to finally, which would be safer, but in 
this case irrelevant for no exception ever happens, can you perhaps see a 
possible culprit?

Side question: originally, my // 1 line looked like 
(localec=ERXEC.newEditingContext(osc)).lock(). Far as I can say, should work 
precisely same way as the above, but did not: when the osc was null, I've got 
an invalid EC with a null rootObjectStore. What the H.?!?

Thanks and all the best,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


fetches too often (was: weird locks) in faultWithPrimaryKeyValue

2024-08-17 Thread ocs--- via Webobjects-dev
Hi there,

(I've solved the locks — were caused by a stray background thread which I've 
completely forgot of; and Samuel — yes, it was related to logging. D'oh.)

Now it works all right and reliably, but I observe very strange behaviour: with 
the separate OSC, the direct action is, in average, considerably slower; and 
the culprit seems are DB roundtrips. I hope I am missing something completely 
obvious again...

When I create my local EC for my direct action this way:

===
if (!sharedosc) sharedosc=new EOObjectStoreCoordinator()
localec=ERXEC.newEditingContext(sharedosc)
===

almost each time the fault created through this EC is accessed, there's a DB 
roundtrip. On the other hand, if I create it this way (without any other change)

===
if (!sharedosc) sharedosc=EOEditingContext.defaultParentObjectStore()
localec=ERXEC.newEditingContext(sharedosc)
===

there are no roundtrips at all.

I would understand the first fetch in the separate OSC, but subsequently, it 
should just use snapshots like the default root store does, should it not? What 
am I missing?

Thanks,
OC

> On 16. 8. 2024, at 18:14, ocs--- via Webobjects-dev 
>  wrote:
> 
> Hi there,
> 
> I've got a direct action, which sometimes needs to get an object with a known 
> PK, for which I use faultWithPrimaryKeyValue. Works well for years, but 
> lately the fetches went longer, so I decided to allow it to use a separate 
> OSC not to clash with the normal database requests.
> 
> The result is weird:
> - sometimes, faultWithPrimaryKeyValue in the dedicated OSC is lightning fast, 
> as presumed
> - sometimes though, it never ends?!? :-O
> 
> It does not lock once and then stay locked, the cases are intermittent. Also, 
> it never locks when I test myself at my development machine; happens on the 
> deployment site only, sigh. I have also reasons to believe that the DA does 
> not deadlock with another thread (essentially since at the moment of the 
> first lock, nothing at all ran in parallel).
> 
> The code looks like this:
> ===
> static sharedosc
> WOActionResults someAction() {
>   try {
> boolean oscpolicy=ERXProperties.booleanForKey('ActionSpecificOSC')
> def localec, osc
> ... ...
> for (... a couple of times ...) {
>   ...
>   if (some-condition-which-says-I-need-to-fetch) {
> if (!localec) {
>   if (oscpolicy && !sharedosc) sharedosc=new 
> ERXObjectStoreCoordinator(true)
>   
> (localec=ERXEC.newEditingContext(sharedosc?:EOEditingContext.defaultParentObjectStore())).lock()
>  // 1
> }
> log "/TEMP will fetch in $localec..." // 2
> eo=EOUtilities.faultWithPrimaryKeyValue(localec ,'DBAuction', 
> Integer.valueOf(map.eoprimarykey))
> log "/TEMP ... did fetch in $localec"
>   }
>   ...
> }
> ... ...
> if (localec) localec.dispose()
>   } catch (exc) {
> some-log-which-never-happens-thus-I-know-the-above-never-threw
>   }
> }
> ===
> 
> When ActionSpecificOSC is off, it never ever locks. When it is on though, 
> occasionally the “will fetch” log marked // 2 is the very last thing which 
> the appropriate worker thread ever does. In other (intermittent) cases it all 
> works well.
> 
> Aside of moving the localec.dispose to finally, which would be safer, but in 
> this case irrelevant for no exception ever happens, can you perhaps see a 
> possible culprit?
> 
> Side question: originally, my // 1 line looked like 
> (localec=ERXEC.newEditingContext(osc)).lock(). Far as I can say, should work 
> precisely same way as the above, but did not: when the osc was null, I've got 
> an invalid EC with a null rootObjectStore. What the H.?!?
> 
> Thanks and all the best,
> OC
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/ocs%40ocs.cz
> 
> This email sent to o...@ocs.cz

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: fetches too often (was: weird locks) in faultWithPrimaryKeyValue

2024-08-18 Thread ocs--- via Webobjects-dev
Samuel,

> On 17. 8. 2024, at 15:59, Samuel Pelletier  wrote:
> If you create a new OSC, you will have no snapshot cache (I may be wrong on 
> this), so it is the expected behaviour.

I might be missing something, but I understand each OSC has its own set of 
snapshots. Independent on other OSCs, of course, but should work normally 
inside an OSC. Was I wrong?

> I never create new OSC in my apps, why are you creating OSC like this ?

To create an independent DB channnel, so that my fetches in this OSC do not 
need to wait for (potentially long) fetches in other OSCs.

> If your fetches are long, check your database indexes.

They are fast, the problem is that they happen at all. I log EC, OSC, and SQL, 
and it looks like this (they run in the same thread just by a chance; each 
time, it's a new R/R loop, they get assigned the same thread just since I do 
nothing else in the app at the moment):

===
18 12:58:34.815|WorkerThread2/TEMPLOG created ec EC:5e8666eb/OSC:69463522
12:58:34.816 DEBUG "DBAuction"@453059304 expression took 1 ms: SELECT ... FROM 
"T_AUCTION" t0 WHERE t0."C_UID" = 1000147   
//log:er.extensions.ERXAdaptorChannelDelegate.sqlLogging [WorkerThread2]
18 12:58:35.852|WorkerThread2 /TEMPLOG created ec EC:267a80b0/OSC:69463522
12:58:35.853 DEBUG "DBAuction"@453059304 expression took 1 ms: SELECT ... FROM 
"T_AUCTION" t0 WHERE t0."C_UID" = 1000147   
//log:er.extensions.ERXAdaptorChannelDelegate.sqlLogging [WorkerThread2]
18 12:58:36.863|WorkerThread2 /TEMPLOG created ec EC:7bcddf5b/OSC:69463522
12:58:36.880 DEBUG "DBAuction"@453059304 expression took 1 ms: SELECT ... FROM 
"T_AUCTION" t0 WHERE t0."C_UID" = 1000147   
//log:er.extensions.ERXAdaptorChannelDelegate.sqlLogging [WorkerThread2]
===

Note that each time a new EC is created (that's all right), but they all belong 
to the same OSC (69463522). Yet, each time there's a fetch of the same object 
(1000147). I must be missing something of importance; I believe there should be 
only the 1st one, while instead of the latter ones the fault should get fired 
quickly through snapshots of the OSC without a DB roundtrip.

Thanks,
OC

>> Le 17 août 2024 à 08:48, ocs--- via Webobjects-dev 
>>  a écrit :
>> 
>> Hi there,
>> 
>> (I've solved the locks — were caused by a stray background thread which I've 
>> completely forgot of; and Samuel — yes, it was related to logging. D'oh.)
>> 
>> Now it works all right and reliably, but I observe very strange behaviour: 
>> with the separate OSC, the direct action is, in average, considerably 
>> slower; and the culprit seems are DB roundtrips. I hope I am missing 
>> something completely obvious again...
>> 
>> When I create my local EC for my direct action this way:
>> 
>> ===
>> if (!sharedosc) sharedosc=new EOObjectStoreCoordinator()
>> localec=ERXEC.newEditingContext(sharedosc)
>> ===
>> 
>> almost each time the fault created through this EC is accessed, there's a DB 
>> roundtrip. On the other hand, if I create it this way (without any other 
>> change)
>> 
>> ===
>> if (!sharedosc) sharedosc=EOEditingContext.defaultParentObjectStore()
>> localec=ERXEC.newEditingContext(sharedosc)
>> ===
>> 
>> there are no roundtrips at all.
>> 
>> I would understand the first fetch in the separate OSC, but subsequently, it 
>> should just use snapshots like the default root store does, should it not? 
>> What am I missing?
>> 
>> Thanks,
>> OC
>> 
>>> On 16. 8. 2024, at 18:14, ocs--- via Webobjects-dev 
>>> mailto:webobjects-dev@lists.apple.com>> 
>>> wrote:
>>> 
>>> Hi there,
>>> 
>>> I've got a direct action, which sometimes needs to get an object with a 
>>> known PK, for which I use faultWithPrimaryKeyValue. Works well for years, 
>>> but lately the fetches went longer, so I decided to allow it to use a 
>>> separate OSC not to clash with the normal database requests.
>>> 
>>> The result is weird:
>>> - sometimes, faultWithPrimaryKeyValue in the dedicated OSC is lightning 
>>> fast, as presumed
>>> - sometimes though, it never ends?!? :-O
>>> 
>>> It does not lock once and then stay locked, the cases are intermittent. 
>>> Also, it never locks when I test myself at my development machine; happens 
>>> on the deployment site only, sigh. I have also reasons to believe that the 
>>> DA does not deadlock with another thread (essentially since at the moment 
>>> of the first lock, nothing at all ran in parallel).
>>> 
>>

overlapping R/Rs in same session

2024-08-19 Thread ocs--- via Webobjects-dev
Hi there,

looks like the main cause of those overlapping R/Rs which we ar clashing with 
lately is that some users just open their session in more windows or tabs, and 
work concurrently in those. Sigh.

It's self-evident why it is a pretty bad idea from the technical POV, but I am 
afraid we can't explain it to plain users. Worse, if we found a way to prevent 
that (offhand, I am not sure whether it is technically possible, but even if 
so), I am afraid the users would complain that they simply insist on this 
terrible approach.

Now though they complain some operations are “inexplicably” slow: “I understand 
that operation A which I've launched in one of my windows is complicated and 
thus takes many seconds, that's OK. But at the same moment I've launched an 
operation B in another of my windows; operation B is trivial and should be 
lightning fast, but it took an eternity! Fix your broken application!“

Well you twit, op B took an eternity since it first waited many seconds until 
the slow op A you yourself launched in the same session finished; after that, A 
took about 100 ms of its own time. But this kind of explanation would not do 
with plain users at all :(

Could anybody see any practical solution?

Note please that making _all_ R/R lightning fast is practically impossible (we 
would have to refactor too heavily, not an option in a near future). Besides I 
am afraid even if we somehow succeeded to make all R/R reliably belong a second 
or so, they would still launch ten second-long operations in ten windows plus 
one 100 ms in another, and then complain that the last one took seconds too :(

At this moment about the only solution very ugly work-around I can think of 
would be to choose a couple of the trivial operations whose speed the users 
consider most important, and re-write them without session (they would still 
need to work with the session ID, but important things like the current user 
etc. would have to be cached in the application in some kind of static map 
without using the Session instance at all). Sigh. Darn complex, but still 
worlds easier than attempting to make _all_ R/Rs 100ms-or-less...

Any better idea?

Thanks and all the best,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: FB JDBC version?

2024-08-23 Thread ocs--- via Webobjects-dev
Jesse,

I might be wrong, but I understand this is not the driver version, but a JDBC 
compatibility level or something like that. Anyway, the FrontBase driver 
version is three-part (like 2.5.10), not just major.minor.

Thanks!
OC

> On 22. 8. 2024, at 22:48, Jesse Tayler  wrote:
> 
> I happen to use a different API, perhaps results are different.
> 
> java.sql.Driver driver = java.sql.DriverManager.getDriver(“my login string…”);
> ERXApplication.log.info("Driver Version: " + driver.getMajorVersion() + "." + 
> driver.getMinorVersion());
> 
> 
>> On Aug 22, 2024, at 3:54 PM, OCsite via Webobjects-dev 
>>  wrote:
>> 
>> Hi there,
>> 
>> how does one properly determine the current FB JDBC driver version?
>> 
>> Lately we were not sure whether all our installations contain the newest 
>> release, and thus I've added a code to log out the version. The code I've 
>> found — is there another, better, and more reliable variant? — looks like 
>> this:
>> 
>> ===
>> def eoa=EOAdaptor.adaptorWithModel(model)
>> def pin=eoa.plugIn()
>> logln "using driver $eoa.plugInName ${pin.jdbcInfo['DRIVER_VER']}"
>> ===
>> 
>> The problem is, this code gives me different results (sometimes 2.5.10, 
>> sometimes 2.5.9) for the very same frontbasejdbc.jar (which should really be 
>> 2.5.20 — 240643 bytes, md5 72266d135712d26c60bc5cc1e1dc7c94). What do I 
>> overlook?
>> 
>> Thanks,
>> OC
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
>> 
>> This email sent to jtay...@oeinc.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: FB JDBC version?

2024-08-23 Thread ocs--- via Webobjects-dev
Ramsey,

looks like you are again right. Meantime I've investigated, and it looks like
- the bloody Java, despite having an explicit path to the proper driver on 
classpath (I've checked in runtime logs, it's OK), still ignores it and loads 
another driver from java.ext.dirs;
- where, I believe, a FrontBase driver should never be anyway, but some 
proactive admin seems to have put the old version to. Ick!

Is there a decent way for a given JAR to log out a path from which it has been 
really loaded? I've tried to search Net, but did not found any. There are ways 
to find a path for a known class (but I do not know which classes there are in 
the FrontBase driver; and if I find a class they use now, it might fail in 
future if they change the names), and even those, based on a 
getProtectionDomain which might throw, are a bit complex to my liking...

Thanks a lot!
OC

> On 22. 8. 2024, at 22:51, Ramsey Gurley  
> wrote:
> 
> Are you sure you don't have more than one jdbc jar floating around in your 
> application build path? With ant, I forget how it determines which jar wins. 
> With maven, you can just open the pom.xml in eclipse and check in the 
> Dependency Hierarchy tab.
> From: OCsite via Webobjects-dev 
> Sent: Thursday, August 22, 2024 2:54 PM
> To: WebObjects-Dev List 
> Subject: FB JDBC version?
>  
> Hi there,
> 
> how does one properly determine the current FB JDBC driver version?
> 
> Lately we were not sure whether all our installations contain the newest 
> release, and thus I've added a code to log out the version. The code I've 
> found — is there another, better, and more reliable variant? — looks like 
> this:
> 
> ===
> def eoa=EOAdaptor.adaptorWithModel(model)
> def pin=eoa.plugIn()
> logln "using driver $eoa.plugInName ${pin.jdbcInfo['DRIVER_VER']}"
> ===
> 
> The problem is, this code gives me different results (sometimes 2.5.10, 
> sometimes 2.5.9) for the very same frontbasejdbc.jar (which should really be 
> 2.5.20 — 240643 bytes, md5 72266d135712d26c60bc5cc1e1dc7c94). What do I 
> overlook?
> 
> Thanks,
> OC
> Confidentiality Notice: This email, including all attachments and replies 
> thereto, are covered by the Electronic Communications Privacy Act, 18 U.S.C. 
> Sections 2510-2521 and are legally privileged. This information is 
> confidential, and intended only for the use of the individuals or entities 
> named above. If you are not the intended recipient, you are hereby notified 
> that any disclosure, copying, distribution or the taking of any action in 
> reliance on the contents of this transmitted information is strictly 
> prohibited. Please notify us if you have received this transmission in error. 
> Thank you.

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


how to prevent locking of other ECs?

2024-10-26 Thread ocs--- via Webobjects-dev
Hi there,

from inside of a R/R, I need to do something (essentially just log out some 
attributes; no changes) with some objects of other editing contexts.

To prevent deadlocks, of course I cannot lock those other ECs. Since an 
attribute access does lock, I am using localInstanceIn, essentially like this:

===
for (ERXEC otherEC in listOfOtherECs) { // works all right, my method 
listOfOtherECs never fails
  def otherEO=neededEOInEC(otherEC) // works all right, my method neededEOInEC 
never fails and returns an EO in otherEC
  def myEO=otherEO.localInstanceIn(session.defaultEditingContext)
  ... work with myEO as needed ...
}
===

The catch is, localInstanceIn locks, too, and thus I _do_ get the deadlocks 
which I needed to prevent :(

Is there a way to dodge the darned locking of the other ECs?

Thanks,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: qualifier-linked-to-EC woes

2024-09-20 Thread ocs--- via Webobjects-dev
Just a quick followup: currently I use 
ERXEOControlUtilities.localInstancesInQualifier to move the whole qualifier 
into the EC in which it is being evaluated.

It works, but a truly EC-agnostic qualifier would be much better, for this 
leads to converting qualifiers pretty often :(

Thanks!
OC

> On 21. 9. 2024, at 0:45, OCsite via Webobjects-dev 
>  wrote:
> 
> Hi there,
> 
> a qualifier should be independent on ECs and work just as well in any of 
> them, right? Well, wrong :( If there's a key-value (sub-)qualifier like this:
> 
> ===
> def qq=EOQualifier.qualifierWithQualifierFormat("aRelationship=%@",new 
> NSArray(someEO))
> ===
> 
> then I can reliably fetch using this qualifier in any EC (since it translates 
> to simple check of the FK SQL-side), but I cannot use this qualifier in any 
> other EC to evaluate, for it does not work, like this:
> 
> ===
> def anotherEC=ERXEC.newEditingContext()
> def eos=anotherEC.objectsWithFetchSpecification(new 
> EOFetchSpecification('ProperEntity',qq,null)) // fetches all right, this 
> works like a charm
> for (eo in eos) println "matches: "+qq.evaluateWithObject(eo) // none matches 
> though
> ===
> 
> All the objects report “matches: false”, for self-evidently, in-memory 
> evaluation instead of comparing the FK directly compares the objects. Sigh.
> 
> Isn't there a trick to make a truly EC-agnostic qualifier? I've tried to 
> replace each KeyValue(relName,same,eo) by appropriate 
> KeyValue(relFKAttributeName,same,eo.rawPrimaryKey), but that fails, since 
> EOKeyValueQualifier can't work with attributes which are not class properties 
> :(
> 
> Can anybody see a reasonable work-around?
> 
> Thanks!
> OC
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/ocs%40ocs.cz
> 
> This email sent to o...@ocs.cz

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


supported DB servers

2024-10-03 Thread ocs--- via Webobjects-dev
Hi there,

is there somewhere a list of SQL databases which we can use with WO+Wonder 
today (perhaps with some howtos and gotchas, if known)?

All I've found is

https://en.wikibooks.org/wiki/WebObjects/EOF/Using_EOF/Database_Adaptors_and_Plugins

which says it is outdated and offers a link to newer one... which link does not 
work at all, looks like that “newer” server does not exist anymore.

Thanks!
OC
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NScollections vs Java collections

2025-02-01 Thread ocs--- via Webobjects-dev
Hi there,

did ever anybody tried some benchmarks to find whether it is better to use WO 
collections (NSArray, NSDictionary...) as widely as possible (ie essentially 
anywhere, unless one really needs to store nulls or can't do without 
ConcurrentHashMap or so), or whether it's better to use standard collections 
(List, HashMap...) wherever they happen to work properly (which is surprisingly 
often, but not anywhere)?

Are they roughly comparable, or are one or the others considerably better?

Thanks!
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Does anyone use WOLips groovy support?

2024-12-18 Thread ocs--- via Webobjects-dev
Ramsey,

> On 18. 12. 2024, at 11:37, Ramsey Gurley via Webobjects-dev 
>  wrote:
> ...
> Which just leaves the WOLips groovy support. My question is again, does 
> anyone use this? The only mention I find of it is a short groovy.mov on the 
> wiki, and it appears  that it is designed to do rapid turnaround as well. 
> Does anyone out there still use and love this feature or is it something we 
> can also remove?

Note please this is probably quite irrelevant for WOLips — I do not and most 
probably never will use WOLips, since I found Eclipse very much lacking, so 
terrible an IDE it was worth to me to make scripts which allow me to do all my 
WO development in Xcode (including my own standalone EOModeller 
), even though tweaking it to support 
Groovy is non-trivial. Thus, I do not really know how the WOLips Groovy support 
looks like and whether it is worth keeping.

Nevertheless, I'd like to heartily recommend Groovy in general to anyone who 
never has tried it yet. Groovy is almost* perfect language for WebObjects; 
unlike Java, whose stupid design and very static approach enforces heaps of 
boilerplate and rather weird work-arounds. Groovy offers dynamic features 
roughly comparable with ObjC; for one, it is pretty easy to generate EO 
accessors runtime based on model (sort of like CoreData do), without a need to 
mess with generated code at all.

* There are some drawbacks (mostly inherited from Java/caused by JRE), e.g., 
getter names presumed getFoo instead of proper foo, or the lack of class 
methods, or that the Groovy class extensions (Groovy can add methods somewhat 
like ObjC categories do) sadly do not work with reflexion (key-value coding). 
Groovy typechecking is bad. Still, the advantages are tremendous. Also, since I 
use Xcode exclusively, I have absolutely no idea how difficult it would be to 
make any other IDE to do proper Groovy completions, this might prove a big 
hurdle possibly.

All the best,
OC

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: JavaMonitor DAs

2025-01-26 Thread ocs--- via Webobjects-dev
Amedeo,

> On 25. 1. 2025, at 10:12, Amedeo Mantica  wrote:
> Take a look at source code

Hmmm, I've tried, but it looks like AdminAction 

 just uses MInstance; and whatever I try, I can't find the source of that 
thing?!?

Thanks and all the best,
OC

>> On 25 Jan 2025, at 10:12, Amedeo Mantica  wrote:
>> 
>> I used these in the past for an auto deploy script. Quite handy. 
>> Sent from my iPhone
>> 
>>> On 25 Jan 2025, at 03:47, OCsite via Webobjects-dev 
>>>  wrote:
>>> 
>>> Hi there,
>>> 
>>> does actually anyone use those nice JavaMonitor Direct Actions, documented 
>>> at
>>> 
>>> https://wiki.wocommunity.org/xwiki/bin/view/documentation/Home/Deployment/Wonder%20JavaMonitor%20and%20wotaskd/
>>>  
>>> 
>>> 
>>> ? I've just improved my install scripts to exploit them, but bumped into a 
>>> problem: I might be missing something of importance, but there seems to be 
>>> no way to get an instance-level configuration at all, for
>>> 
>>> - JavaMonitor.woa/ra/mApplications.json returns application-level config; 
>>> never takes into account parameters which happen to be overridden 
>>> instance-level;
>>> 
>>> - JavaMonitor.woa/admin/info, regardless the type, does not return the 
>>> configuration at all (e.g., the application path or the log path) — it 
>>> returns only the current state.
>>> 
>>> Do I overlook something? Is there a way to determine the instance-level 
>>> setup?
>>> 
>>> Thanks and all the best,
>>> OC
>>> 
>>> ___
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/amedeomantica%40me.com
>>> 
>>> This email sent to amedeomant...@me.com
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/amedeomantica%40me.com
>> 
>> This email sent to amedeomant...@me.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: That pesky Amount read didn't match content-length ...

2025-02-13 Thread ocs--- via Webobjects-dev
Hugi,

well I can't say I _entirely_ understand the behaviour (probably would have to 
analyse and understand the adaptor code first), but my testing sort of suggests 
that

(i) the culprit is too long a computation in the takeValuesFromRequest phase

I've tried to prolong it artificially first, but it did not cause the problem. 
Looks like that if there's just a Thread.sleep, it still works. Probably in 
this case the application is still responsive enough, but when computing 
heavily instead, it is not.

(ii) when the uploaded file size extends some threshold, the adaptor seems to 
try to contact the application during this phase, does not get answer in time, 
and goes the

===
Debug: sendBuffers(): timed out
Error: error sending request
Error: Failed to send request
Info: Marking instance 1 dead
===

routine. This happens at a couple of seconds of takeValuesFromRequest. If 
takeValuesFromRequest is considerably shorter (or long, but just due a 
Thread.sleep), this problem never occurs regardless the upload size (well 
tested just up to about 75 MB :))

This part I do not quite get: it sort of seems the longer the uploaded file, 
the sooner tries the adaptor to contact the application, which does not seem to 
make sense to me.

Anyway, the answer is never allow the takeValuesFromRequest phase to get too 
long (and computation-heavy), which I should be able to fix with some smart 
caching.

Thanks a lot for all the help!
OC


> On 13. 2. 2025, at 20:02, ocs--- via Webobjects-dev 
>  wrote:
> 
> Well I couldn't easily try the streamed upload, for it requires a 
> single-action form; nevertheless I have tried streamToFilePath — with 
> precisely the same outcome as normal upload :(
> 
>> On 13. 2. 2025, at 13:20, OCsite via Webobjects-dev 
>> mailto:webobjects-dev@lists.apple.com>> 
>> wrote:
>> 
>> Thanks!
>> 
>>> On 13. 2. 2025, at 12:49, Hugi Thordarson via Webobjects-dev 
>>> mailto:webobjects-dev@lists.apple.com>> 
>>> wrote:
>>> Sorry, then I'm kind of out of ideas.
>> 
>> Makes two of us :)
>> 
>>> My first thought was that the adaptor logging was accurate and that the 
>>> application's adaptor configuration was set up so that the file upload 
>>> request actually times out. But creating a simple file upload page and 
>>> setting all the adaptor timeouts to a short period didn't replicate your 
>>> issue — the exception that gets logged in that case is gool ol' 
>>> "SoketException: Broken pipe".
>> 
>> Far as I know, there's one way to replicate it: start a big upload, and 
>> before it finishes, break it at the browser side (eg in Safari by the × at 
>> the right side of the address field). In my experience, this reliably causes 
>> “Amount read didn't match content-length”.
>> 
>> Which though is just as expected in this case and does not help at all with 
>> the problem when this happens _without_ breaking the upload at the client 
>> side. Besides it does not cause marking the instance as dead (which is 
>> bogus; the instance runs all right, and a subsequent attempt to contact it 
>> works normally).
>> 
>>> Are you using a regular old WOFileUpload with "data" and "filePath" bindings
>> 
>> Yep.
>> 
>>> or are you using other/streaming bindings?
>> 
>> Good idea — I'll try that, in a vain hope it might help :)
>> 
>>> I can test this again with streaming if that turns out to be your case 
>>> (performing a 300MB upload with the odl style bindings and timeouts 
>>> properly set works fine for me through the Apache adaptor).
>> 
>> Actually I don't think you should be able to repeat the problem. I suspect 
>> it would be related to some setting or specific site condition. I am pretty 
>> sure I've successfully uploaded much bigger files on another site into the 
>> same application.
>> 
>> Thanks a lot,
>> OC
>> 
>>> 
>>> Cheers,
>>> - hugi
>>> 
>>> 
>>>> On 13 Feb 2025, at 11:17, OCsite mailto:o...@ocs.cz>> wrote:
>>>> 
>>>> Hugi,
>>>> 
>>>>> On 13. 2. 2025, at 9:55, Hugi Thordarson via Webobjects-dev 
>>>>> mailto:webobjects-dev@lists.apple.com>> 
>>>>> wrote:
>>>>> when you say 2 MB, is it possible you mean 2 GB?
>>>> 
>>>> Nope. The file which fails to upload has 2 024 943 bytes.
>>>> 
>>>>> ...
>>>>> Is this also a problem in direct connect mode or only if you're going 
>>>>&

That pesky Amount read didn't match content-length ...

2025-02-12 Thread ocs--- via Webobjects-dev
Hi there,

is there a known cure for the darned “IOException: Connection reset by peer: 
Amount read didn't match content-length” exception upon a file upload?

Started to happening to us lately. Smaller files upload all right, bigger ones 
(from about 2 MB up) trigger this error. Increasing the Java memory through 
-Xmx does not seem to help.

Thanks!
OC
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: That pesky Amount read didn't match content-length ...

2025-02-13 Thread ocs--- via Webobjects-dev
Well I couldn't easily try the streamed upload, for it requires a single-action 
form; nevertheless I have tried streamToFilePath — with precisely the same 
outcome as normal upload :(

> On 13. 2. 2025, at 13:20, OCsite via Webobjects-dev 
>  wrote:
> 
> Thanks!
> 
>> On 13. 2. 2025, at 12:49, Hugi Thordarson via Webobjects-dev 
>>  wrote:
>> Sorry, then I'm kind of out of ideas.
> 
> Makes two of us :)
> 
>> My first thought was that the adaptor logging was accurate and that the 
>> application's adaptor configuration was set up so that the file upload 
>> request actually times out. But creating a simple file upload page and 
>> setting all the adaptor timeouts to a short period didn't replicate your 
>> issue — the exception that gets logged in that case is gool ol' 
>> "SoketException: Broken pipe".
> 
> Far as I know, there's one way to replicate it: start a big upload, and 
> before it finishes, break it at the browser side (eg in Safari by the × at 
> the right side of the address field). In my experience, this reliably causes 
> “Amount read didn't match content-length”.
> 
> Which though is just as expected in this case and does not help at all with 
> the problem when this happens _without_ breaking the upload at the client 
> side. Besides it does not cause marking the instance as dead (which is bogus; 
> the instance runs all right, and a subsequent attempt to contact it works 
> normally).
> 
>> Are you using a regular old WOFileUpload with "data" and "filePath" bindings
> 
> Yep.
> 
>> or are you using other/streaming bindings?
> 
> Good idea — I'll try that, in a vain hope it might help :)
> 
>> I can test this again with streaming if that turns out to be your case 
>> (performing a 300MB upload with the odl style bindings and timeouts properly 
>> set works fine for me through the Apache adaptor).
> 
> Actually I don't think you should be able to repeat the problem. I suspect it 
> would be related to some setting or specific site condition. I am pretty sure 
> I've successfully uploaded much bigger files on another site into the same 
> application.
> 
> Thanks a lot,
> OC
> 
>> 
>> Cheers,
>> - hugi
>> 
>> 
>>> On 13 Feb 2025, at 11:17, OCsite  wrote:
>>> 
>>> Hugi,
>>> 
>>>> On 13. 2. 2025, at 9:55, Hugi Thordarson via Webobjects-dev 
>>>>  wrote:
>>>> when you say 2 MB, is it possible you mean 2 GB?
>>> 
>>> Nope. The file which fails to upload has 2 024 943 bytes.
>>> 
>>>> ...
>>>> Is this also a problem in direct connect mode or only if you're going 
>>>> through the web server adaptor?
>>> 
>>> Direct connect works all right, the problem is only adaptor-side. I've 
>>> tried to log adaptor, and perhaps the problem might be this?
>>> 
>>> ===
>>> Debug:  new translate: 
>>> /cgi-bin/WebObjects/CEBOIS.woa/wo/14.2
>>> Info:  new request: 
>>> /cgi-bin/WebObjects/CEBOIS.woa/wo/14.2
>>> Debug: App Name: CEBOIS.woa/wo/14.2 (6)
>>> Debug: req_allocateContent(): content will be streamed. content length = 
>>> 2031013
>>> Info: V4 URL: /cgi-bin/WebObjects/CEBOIS.woa/wo/14.2
>>> Info: Cookie instance 1 from woinst=1; wosid=bYkhovnML9gbkEGcLKmzUw; 
>>> routeid_cebois=.cebois_2004; routeid_sd3test=.sd3test_2016; 
>>> routeid_ema3=.ema3_2001; routeid_ema=.ema_2010
>>> Info: Selecting specific app instance 1.
>>> Debug: Composed URL to '/cgi-bin/WebObjects/CEBOIS.woa/1/wo/14.2'
>>> Info: New request is POST /cgi-bin/WebObjects/CEBOIS.woa/1/wo/14.2 HTTP/1.1
>>> 
>>> Info: Sending request to instance number 1, port 2004
>>> Info: Trying to contact CEBOIS:1 on (2004)
>>> Info: attempting to connect to 127.0.0.1 on port 2004
>>> Info: CEBOIS:1 on (2004) connected [pooled: No]
>>> Debug: sendBuffers(): timed out
>>> Error: error sending request
>>> Error: Failed to send request
>>> Info: Marking instance 1 dead
>>> Warn: Marking 127.0.0.1:1 unresponsive
>>> Debug: connectionAttempts = 1, retries = 0
>>> Info: Reading configuration from 
>>> http://localhost:1085/WebObjects/wotaskd.woa/wa/woconfig
>>> Info: attempting to connect to localhost on port 1085
>>> Info: Preparing to read config for host: localhost
>>> Info: New response: HTTP/1.0 200 Apple WebObjects
>>> Debug: Header read: last-modified: Thu, 13 Feb 2025 11:14:38 GMT
>&

obtain a BLOB size without fetching the whole thing?

2025-06-24 Thread ocs--- via Webobjects-dev
Hi there,

the subject says it all. I've got a FS which reads in some columns set up 
through setRawRowKeyPaths. The entity contains also a BLOB column which can be 
rather big. Is there a trick to get its size only in the result dictionaries, 
without actually fetching the data?

If db-specific, with FrontBase.

Thanks a lot!
OC
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: obtain a BLOB size without fetching the whole thing?

2025-06-24 Thread ocs--- via Webobjects-dev
Great, thanks! Works like a charm :)

If there is a trick to do this at a higher EOF level, would be nice, but if 
there's none, this solves my problem all right. Thanks again!

All the best,
OC

> On 24. 6. 2025, at 23:25, Amedeo Mantica  wrote:
> 
> try something like this...
> (raw SQL)
> 
> SELECT id, OCTET_LENGTH(blob_col) AS blob_size_bytes FROM my_table;
> 
>> Il giorno 24 giu 2025, alle ore 21:27, ocs--- via Webobjects-dev 
>>  ha scritto:
>> 
>> Hi there,
>> 
>> the subject says it all. I've got a FS which reads in some columns set up 
>> through setRawRowKeyPaths. The entity contains also a BLOB column which can 
>> be rather big. Is there a trick to get its size only in the result 
>> dictionaries, without actually fetching the data?
>> 
>> If db-specific, with FrontBase.
>> 
>> Thanks a lot!
>> OC
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/amedeomantica%40me.com
>> 
>> This email sent to amedeomant...@me.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: suspicious sessions and R/R loops created for a CSS font

2020-01-10 Thread ocs@ocs via Webobjects-dev
Chuck,

thanks!

> On 10 Jan 2020, at 7:23 AM, Chuck Hill  wrote:
> I am pretty sure it is the relative URLs in font-awesome.min.css.  They get 
> evaluated as relative to  the URL of your page not the URL of that CSS.

That idea occurred to me too, but I think in that case it would not work (would 
not render the characters properly), for the fonts would not be loaded at all 
from such bogus URLs, would they?

Anyway I have tried to change the URLs in the CSS file to absolute ones like 
this:

===
 @font-face {
font-family: 'FontAwesome';
src: url('/dms/css/font-awesome/fonts/fontawesome-webfont.eot?v=4.6.3');
src: 
url('/dms/css/font-awesome/fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') 
format('embedded-opentype'), 
url('/dms/css/font-awesome/fonts/fontawesome-webfont.woff2?v=4.6.3') 
format('woff2'), 
url('/dms/css/font-awesome/fonts/fontawesome-webfont.woff?v=4.6.3') 
format('woff'), 
url('/dms/css/font-awesome/fonts/fontawesome-webfont.ttf?v=4.6.3') 
format('truetype'), 
url('/dms/css/font-awesome/fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular')
 format('svg');
font-weight: normal;
font-style:normal
}
===

and the problem persists. It persists even if I use complete URLs incl. the 
server, like “http://localhost:56005/dms/css/font-awesome...”, which I tried 
too.

So, triple alas, that would not be the culprit, I fear.

Thanks and all the best,
OC

>> On Jan 9, 2020, at 5:48 PM, OCsite via Webobjects-dev 
>>  wrote:
>> 
>> Gentlemen,
>> 
>> my application does some R/R loops and creates some sessions/main components 
>> which I believe it should not.
>> 
>> Lately, from a webdesigner, I have got some improvements of the look of my 
>> application, which essentially looks like
>> 
>> > href="/dms/css/font-awesome/css/font-awesome.min.css"/>
>> 
>> in the html header. The CSS starts with
>> 
>> ===
>> /*!
>> *  Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome
>> *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT 
>> License)
>> */@font-face {
>>   font-family: 'FontAwesome';
>>   src: url('../fonts/fontawesome-webfont.eot?v=4.6.3');
>>   src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') 
>> format('embedded-opentype'), 
>> url('../fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2'), 
>> url('../fonts/fontawesome-webfont.woff?v=4.6.3') format('woff'), 
>> url('../fonts/fontawesome-webfont.ttf?v=4.6.3') format('truetype'), 
>> url('../fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') 
>> format('svg');
>>   font-weight: normal;
>>   font-style:normal
>> }
>> ===
>> 
>> Then, things like
>> 
>> 
>> 
>> are used throughout the component templates, with the appropriate classes 
>> looking like
>> 
>> ===
>> .fa {
>>   display: inline-block;
>>   font: normal normal normal 14px/1 FontAwesome;
>>   font-size: inherit;
>>   text-rendering: auto;
>>   -webkit-font-smoothing: antialiased;
>>   -moz-osx-font-smoothing:grayscale
>> }
>> .fa-plus:before {
>>   content: "\f067"
>> }
>> ===
>> 
>> It seems to render the characters all right, but the reason why I am writing 
>> is that as soon as the  thing is used in the page, I am getting 
>> VERY suspicious R/R loops and extra sessions. Namely, what I see is that
>> 
>> 1. normal R/R loop for the standard URI "...myapp/wo/SID/COMPONENT" happens, 
>> uses the long-ago-created session for SID as it should, ends by 
>> application.sleep(). Precisely same as if there's no , so far so 
>> good.
>> 
>> But, if there _is_ an  thing in the page, I immediately and 
>> automatically (without doing anything in the browser) get another four R/R 
>> loops (far as I can say, served by the same thread as the first normal one); 
>> each of them creates a new session and a Main page (which is never shown 
>> anywhere), and if I log out its context().request() in the newly created 
>> session's awake(), it seems self-evident these R/R loops are created for the 
>> URIs from the CSS header, namely
>> 
>> 2. ../fonts/fontawesome-webfont.woff2?v=4.6.3
>> 3. ../fonts/fontawesome-webfont.woff?v=4.6.3
>> 4. ../fonts/fontawesome-webfont.ttf?v=4.6.3
>> 5. ../fonts/fontawesome-webfont.svg?v=4.6.3
>> 
>> (For some reason, for those .eot URIs this does not happen.)
>> 
>> Now, I understand that the fonts need to be loaded; nevertheless, it does 
>> not feel right that a full-fledged R/R loop, which creates a session and a 
>> Main page, is created and run for this.
>> 
>> Is that right? As always, I might be overlooking something of importance, 
>> but to me this feels wrong; there should be no need to create a full-fledged 
>> R/R for this, far as I understand. There are many other 
>> resources/CSSs/javascripts the application uses (incl. the very 
>> "font-awesome.min.css"), and none of them causes this; they all are loaded 
>> without R/R loops, without sessions, etc.
>> 
>> The designer knows sweet zilch of WebObjects and says if there's a problem 
>> at all, it's caused by my application a

Re: suspicious sessions and R/R loops created for a CSS font

2020-01-10 Thread ocs@ocs via Webobjects-dev
P.S. Observing ApplicationWillDispatchRequestNotification, in all the cases 
(i.e., with relative "../fonts...", with absolute "/dms/css..." and even with 
"http://localhost:56005/dms/css 
...") I am always getting the same 
URIs in the requests, they always look like this:

WILLDISPATCH http://localhost:56005/cgi-bin/WebObjects/CEBOIS.woa/wo/9MQqLwIwOvKbx5fanbf3w0/5.0.0.9.1.1.1.0.1.1.1],
 user-agent=[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) 
AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.2 Safari/605.1.15]} 
content-length=0 cookies=null userInfo={} storePageInBacktrackCache=true >) 
method=GET uri=/dms/css/font-awesome/fonts/fontawesome-webfont.svg?v=4.6.3 
defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO 
formValueEncoding=UTF-8 formValues={v = ("4.6.3"); } >

Weird. What might be the culprit? Hardly the referer; it would not make sense, 
and besides, to make sure, I have tried request.setHeader('','referer') in the 
ApplicationWillDispatchRequestNotification handler, which did not help either. 

I must admit I can't see even what to try now :-O

Thanks,
OC

> On 10 Jan 2020, at 2:29 PM, ocs@ocs  wrote:
> 
> Chuck,
> 
> thanks!
> 
>> On 10 Jan 2020, at 7:23 AM, Chuck Hill > > wrote:
>> I am pretty sure it is the relative URLs in font-awesome.min.css.  They get 
>> evaluated as relative to  the URL of your page not the URL of that CSS.
> 
> That idea occurred to me too, but I think in that case it would not work 
> (would not render the characters properly), for the fonts would not be loaded 
> at all from such bogus URLs, would they?
> 
> Anyway I have tried to change the URLs in the CSS file to absolute ones like 
> this:
> 
> ===
>  @font-face {
> font-family: 'FontAwesome';
> src: url('/dms/css/font-awesome/fonts/fontawesome-webfont.eot?v=4.6.3');
> src: 
> url('/dms/css/font-awesome/fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') 
> format('embedded-opentype'), 
> url('/dms/css/font-awesome/fonts/fontawesome-webfont.woff2?v=4.6.3') 
> format('woff2'), 
> url('/dms/css/font-awesome/fonts/fontawesome-webfont.woff?v=4.6.3') 
> format('woff'), 
> url('/dms/css/font-awesome/fonts/fontawesome-webfont.ttf?v=4.6.3') 
> format('truetype'), 
> url('/dms/css/font-awesome/fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular')
>  format('svg');
> font-weight: normal;
> font-style:normal
> }
> ===
> 
> and the problem persists. It persists even if I use complete URLs incl. the 
> server, like “http://localhost:56005/dms/css/font-awesome 
> ...”, which I tried too.
> 
> So, triple alas, that would not be the culprit, I fear.
> 
> Thanks and all the best,
> OC
> 
>>> On Jan 9, 2020, at 5:48 PM, OCsite via Webobjects-dev 
>>> mailto:webobjects-dev@lists.apple.com>> 
>>> wrote:
>>> 
>>> Gentlemen,
>>> 
>>> my application does some R/R loops and creates some sessions/main 
>>> components which I believe it should not.
>>> 
>>> Lately, from a webdesigner, I have got some improvements of the look of my 
>>> application, which essentially looks like
>>> 
>>> >> href="/dms/css/font-awesome/css/font-awesome.min.css"/>
>>> 
>>> in the html header. The CSS starts with
>>> 
>>> ===
>>> /*!
>>> *  Font Awesome 4.6.3 by @davegandy - http://fontawesome.io 
>>>  - @fontawesome
>>> *  License - http://fontawesome.io/license  
>>> (Font: SIL OFL 1.1, CSS: MIT License)
>>> */@font-face {
>>>   font-family: 'FontAwesome';
>>>   src: url('../fonts/fontawesome-webfont.eot?v=4.6.3');
>>>   src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') 
>>> format('embedded-opentype'), 
>>> url('../fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2'), 
>>> url('../fonts/fontawesome-webfont.woff?v=4.6.3') format('woff'), 
>>> url('../fonts/fontawesome-webfont.ttf?v=4.6.3') format('truetype'), 
>>> url('../fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') 
>>> format('svg');
>>>   font-weight: normal;
>>>   font-style:normal
>>> }
>>> ===
>>> 
>>> Then, things like
>>> 
>>> 
>>> 
>>> are used throughout the component templates, with the appropriate classes 
>>> looking like
>>> 
>>> ===
>>> .fa {
>>>   display: inline-block;
>>>   font: normal normal normal 14px/1 FontAwesome;
>>>   font-size: inherit;
>>>   text-rendering: auto;
>>>   -webkit-font-smoothing: antialiased;
>>>   -moz-osx-font-smoothing:grayscale
>>> }
>>> .fa-plus:before {
>>>   content: "\f067"
>>> }
>>> ===
>>> 
>>> It seems to render the characters all right, but the reason why I am 
>>> writing is that as soon as the  thing is used in the page, I am 
>>> getting VERY suspicious R/R loops and extra sessions. Namely, what I see is 
>>> that
>>> 
>>> 1. normal R/R loop for the standard URI "...myapp/wo/SID/COMPONENT" 
>>> happens, uses the long-ago-created session for SID as it should, ends by 
>>> application.sleep(). Precisely same as

Re: suspicious sessions and R/R loops created for a CSS font

2020-01-10 Thread ocs@ocs via Webobjects-dev
P.P.S.

> On 10 Jan 2020, at 2:54 PM, ocs@ocs via Webobjects-dev 
>  wrote:
> I must admit I can't see even what to try now :-O

Got an idea to override and log out requestHandlerForKey, and the results 
are... interesting. I thought I'll get the ComponentRequestHandler for those 
bogus requests; I do not! Instead, far as I can say, it's a 
WOStaticResourceRequestHandler, which should be all right, far as I 
understand... could WOStaticResourceRequestHandler ever create R/R loop?!?

Here's what happens, sanitized and make readable (full log below in case I 
removed something of importance).

Any idea what the H. might be happening in there? Me, I'm completely lost :/

===
WorkerThread2 WILLGETHANDLER '_edr_'
WorkerThread2 DIDGETHANDLER ?NULL?
WorkerThread2 WILLDISPATCH 
uri=/cgi-bin/WebObjects/CEBOIS.woa/wo/9UuJz2GsVhmGAeV07uiU2g/2.0.0.9.1.1.1.0.3.1.1
WorkerThread2 WILLGETHANDLER 'wo'
WorkerThread2 DIDGETHANDLER 'wo' -> class 
er.extensions.appserver.ERXComponentRequestHandler

// R/R loop #3 WorkerThread2 started at 18:09:58.789 10.1. // this is 
logged out from Application.awake(), this is the normal R/R loop, all right so 
far
// request secure false, handler 'wo', WOSID 9UuJz2GsVhmGAeV07uiU2g, 
IP:127.0.0.1
// URL: 
/cgi-bin/WebObjects/CEBOIS.woa/wo/9UuJz2GsVhmGAeV07uiU2g/2.0.0.9.1.1.1.0.3.1.1

WorkerThread2 WILLGETHANDLER '_edr_'
WorkerThread2 DIDGETHANDLER ?NULL?
WorkerThread2 WILLDISPATCH 
uri=/cgi-bin/WebObjects/CEBOIS.woa/wr/wodata=/Users/ocs/Library/Developer/Xcode/DerivedData/SberDat3-cacbzkicuhqilyfljzgpbaygdgtm/Build/Products/Debug/SberDat3.woa/Contents/Resources/styles.css
 // normal resource, loaded properly without R/R loop
WorkerThread2 WILLGETHANDLER 'wr'
WorkerThread2 DIDGETHANDLER 'wr' -> class 
com.webobjects.appserver._private.WOResourceRequestHandler
WorkerThread2 WILLGETHANDLER '_edr_'
WorkerThread2 DIDGETHANDLER ?NULL?
WorkerThread2 WILLDISPATCH 
uri=/dms/css/font-awesome/fonts/fontawesome-webfont.woff2?v=4.6.3
WorkerThread2 WILLGETHANDLER ''
WorkerThread2 DIDGETHANDLER ?NULL?
WorkerThread2 WILLGETHANDLER '_wr_'
WorkerThread2 DIDGETHANDLER '_wr_' -> class 
com.webobjects.appserver._private.WOStaticResourceRequestHandler

// R/R loop #4 WorkerThread2 started at 18:09:59.476 10.1. // this is 
logged out from Application.awake()
-IN-sharedEC Created session XARzaDhw1kbKEA8GtBUa70 EC: 
er.extensions.eof.ERXEC@42bdde17 SEC:  - 18:09:59.481 10.1.20|WorkerThread2 // 
Session constructor log

WorkerThread2 WILLGETHANDLER '_edr_'
WorkerThread2 DIDGETHANDLER ?NULL?
WorkerThread2 WILLDISPATCH 
uri=/dms/css/font-awesome/fonts/fontawesome-webfont.woff?v=4.6.3
WorkerThread2 WILLGETHANDLER ''
WorkerThread2 DIDGETHANDLER ?NULL?
WorkerThread2 WILLGETHANDLER '_wr_'
WorkerThread2 DIDGETHANDLER '_wr_' -> class 
com.webobjects.appserver._private.WOStaticResourceRequestHandler

// R/R loop #5 WorkerThread2 started at 18:09:59.664 10.1. // this is 
logged out from Application.awake()
-IN-sharedEC Created session xfFKRWhKfmFYr8YaMRzuc0 EC: 
er.extensions.eof.ERXEC@6b87f93c SEC:  - 18:09:59.668 10.1.20|WorkerThread2 // 
Session constructor log
...
===

etc; essentially the same (i.e., finding the WOStaticResourceRequestHandler 
handler and running an R/R loop) happens twice more.

Thanks and all the best,
OC

Here's the full log for reference, if needed — contains more threads and more 
info for R/Rs, full requests logged out, none of this, I believe, important:

WorkerThread2 WILLGETHANDLER '_edr_'
WorkerThread2 DIDGETHANDLER ?NULL?
WorkerThread2 WILLDISPATCH http://localhost:56005/cgi-bin/WebObjects/CEBOIS.woa/wo/9UuJz2GsVhmGAeV07uiU2g/0.0.0.9.1.3.9],
 upgrade-insecure-requests=[1], user-agent=[Mozilla/5.0 (Macintosh; Intel Mac 
OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.2 
Safari/605.1.15]} content-length=0 cookies=null userInfo={} 
storePageInBacktrackCache=true >) method=GET 
uri=/cgi-bin/WebObjects/CEBOIS.woa/wo/9UuJz2GsVhmGAeV07uiU2g/2.0.0.9.1.1.1.0.3.1.1
 defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO 
formValueEncoding=UTF-8 formValues={} >
WorkerThread2 WILLGETHANDLER 'wo'
WorkerThread2 DIDGETHANDLER 'wo' -> class 
er.extensions.appserver.ERXComponentRequestHandler

//
// R/R loop #3 WorkerThread2 started at 18:09:58.789 10.1.
// request secure false, handler 'wo', WOSID 9UuJz2GsVhmGAeV07uiU2g, 
IP:127.0.0.1
// URL: 
/cgi-bin/WebObjects/CEBOIS.woa/wo/9UuJz2GsVhmGAeV07uiU2g/2.0.0.9.1.1.1.0.3.1.1
// allocated: 85 616 176 of: 225 443 840 max: 2 147 483 648 -- 4.0%
//  last R/R: -98 836 144 added to prev 184 452 320
//  free: 2 061 867 472 -- 96.0%