You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@river.apache.org by "Roy T. Fielding" <fi...@gbiv.com> on 2022/02/08 00:41:24 UTC

[DISCUSS] Moving Apache River to the Attic

Hello everyone,

It's that time of year when I try to figure out what I am doing and
what I am not, and try to cut back on the stuff that seems unlikely
to succeed. I suspect the same is true of others.

I had hoped that more new people at River would result in more activity,
but that hasn't occurred over the past 9 months and doesn't seem likely
in the future. Aside from ASF echoes and Infra-driven website replacement,
there has been nothing to report about River the entire time that I have
been the chair pro tem, and there hasn't been any chatter by users either.

Please feel free to let me know if I am missing something.

If not, I'd like us to accept the reality of this situation and move the
River project to the Attic. The code will still be available there, and
folks are welcome to copy it under the license, move it to Github, or
otherwise seek to re-mold it into a collaborative project wherever is
most convenient for them.

Cheers,

....Roy


Re: [DISCUSS] Moving Apache River to the Attic

Posted by Bryan Thompson <br...@systap.com>.
Concur

On Mon, Feb 7, 2022 at 16:41 Roy T. Fielding <fi...@gbiv.com> wrote:

> Hello everyone,
>
> It's that time of year when I try to figure out what I am doing and
> what I am not, and try to cut back on the stuff that seems unlikely
> to succeed. I suspect the same is true of others.
>
> I had hoped that more new people at River would result in more activity,
> but that hasn't occurred over the past 9 months and doesn't seem likely
> in the future. Aside from ASF echoes and Infra-driven website replacement,
> there has been nothing to report about River the entire time that I have
> been the chair pro tem, and there hasn't been any chatter by users either.
>
> Please feel free to let me know if I am missing something.
>
> If not, I'd like us to accept the reality of this situation and move the
> River project to the Attic. The code will still be available there, and
> folks are welcome to copy it under the license, move it to Github, or
> otherwise seek to re-mold it into a collaborative project wherever is
> most convenient for them.
>
> Cheers,
>
> ....Roy
>
> --
----
Bryan Thompson
Chief Scientist & Founder
Blazegraph
e: bryan@blazegraph.com
w: http://blazegraph.com

Blazegraph products help to solve the Graph Cache Thrash to achieve large
scale processing for graph and predictive analytics.  Blazegraph is the
creator of the industry’s first GPU-accelerated high-performance database
for large graphs, has been named as one of the “10 Companies and
Technologies to Watch in 2016” <http://insideanalysis.com/2016/01/20535/>.

Blazegraph Database <https://www.blazegraph.com/> is our ultra-high
performance graph database that supports both RDF/SPARQL and
Tinkerpop/Blueprints APIs.   Blazegraph GPU
<https://www.blazegraph.com/product/gpu-accelerated/> andBlazegraph DAS
<https://www.blazegraph.com/product/gpu-accelerated/>L are disruptive new
technologies that use GPUs to enable extreme scaling that is thousands of
times faster and 40 times more affordable than CPU-based solutions.

CONFIDENTIALITY NOTICE:  This email and its contents and attachments are
for the sole use of the intended recipient(s) and are confidential or
proprietary to SYSTAP, LLC DBA Blazegraph.  Any unauthorized review, use,
disclosure, dissemination or copying of this email or its contents or
attachments is prohibited. If you have received this communication in
error, please notify the sender by reply email and permanently delete all
copies of the email and its contents and attachments.

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
Hi Bishnu,


Which version of River are you using?


River 3.0 broke compatibility with 2.2, with the com.sun.jini to 
org.apache.river namespace change.  Downstream projects I have looked at 
are still using 2.2, eg Rio.


The River SVN codebase hasn't received much love for a very long time, 
none of the existing releases of River are secure if their connections 
are exposed to the internet, and are vulnerable to Java deserialization 
attacks.   All supported TLS ciphers are out of date, no support for 
stateless TLS etc.    Basically River 2.2 and 3.0 need to stay behind 
the firewall on trusted networks in their current form.


These are the strongest ciphers River supports (ConfidentialityStrength 
STRONG), all are known to be vulnerable to attack:


3DES_EDE_CBC
AES_128_CBC
AES_256_CBC
IDEA_CBC
RC4_128


River downloads code and de-serializes prior to service authentication, 
because it was assumed Java Serialization and the Java Sandbox were 
secure, (based on the old applet model) during Jini 2.0 development.  
River also grants RuntimePermission createClassLoader to downloaded 
proxy code prior to authentication, which code can quite easily be used 
to perform privilege escalation.  It also allows an attacker to steal 
service proxy identity, because identity was based only on codebase 
annotations and the callers ClassLoader.   At least River provided 
httpmd URLs for codebase annotations to avoid code tampering, but it 
doesn't prevent an attacker providing a malicious serialization stream 
to that code and because the attacker can use it to create a ClassLoader 
(the stolen identity has permission to), then they can inject their own 
code anyway.


The last plan we had agreed on was to make River modular and migrate to 
Git, then we could integrate external fixes on a module to module basis 
that would make River secure for the internet, but this never eventuated.


I still maintain my own version of River secured for use over untrusted 
networks on github, where it gets some use, I would donate the code 
should River want it, but it would be a massive undertaking for anyone 
wishing to reinvigorate River, I certainly wouldn't object to someone 
trying.


We tried really hard to make River work for more than a decade.


Issues I needed to address for the internet:


https://github.com/pfirmstone/JGDMS/issues?q=is%3Aissue+is%3Aclosed


https://github.com/pfirmstone/JGDMS/issues/125


https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-jeri/src/main/java/net/jini/jeri/ssl/ConfidentialityStrength.java


According to github traffic stats, there are approximately 13 people per 
month who clone it, so it is only a small community. There is also an 
OpenJDK bug relating to its use of TLS on Java 17: 
https://bugs.openjdk.java.net/browse/JDK-8272340


The codebase is modular, all modules are also OSGi bundles (OSGi is not 
a requirement) and it has a new object marshaling implementation that is 
backward compatible with Java serialization, that doesn't use codebase 
annotations and solves class resolution issues for OSGi deserialization.


A new InvocationLayerFactory has been provided that uses the new 
marshaling implementation, more information regarding ClassLoader 
resolution and codebases can be found here: 
https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-jeri/src/main/java/net/jini/jeri/AtomicILFactory.java


It includes support for IPv6 Address Normalization and IPv6 discovery, 
uses an announcement protocol for global lookup service discovery and it 
supports https unicast lookup discovery.


https://github.com/pfirmstone/JGDMS/issues/81


It also has a compatibility layer based on Rio's use of Jini 2.x. to 
address breakages caused by River 3.0 namespace changes, so it has 
better backward compatibility with River 2.2 than River 3.0.


In any case people who are still using River are welcome to discuss 
their needs and ideas here: https://github.com/pfirmstone/JGDMS/discussions


Cheers,


Peter.


On 10/02/2022 10:48 am, Bishnu Gautam wrote:
> Hi River Team
>
> I am an occasional user/developer of JINI and River. Here are my 
> thoughts on this project.
> Since last summer I am using River to educate my seminar students to 
> learn the concept of distributed computing by using River.
> A couple of students are already working to integrate River with other 
> technologies to cross the NAT and other limitations of
> private network. For example, you can use the technique of UDP hole 
> punching integrating with STUN server to address that problem
> as Peter mentioned. We already have the clear solution for that River 
> is facing on which we are working now.
> I am even thinking to introduce the River from next year as a formal 
> course for my seminar students (as a sub project) seeing the potential
> of this project.
> I think it is too early to decide to move it to Attic as there are 
> some users as of me and my students.
> Instead of moving this project to the corner, why not some of us 
> introduce a working example/or a killer application so that a lots of 
> users
> will have attention on it. Users have difficulties to understand the 
> architecture and how to integrated this architecture to other technology.
> Once we clearly show it, more users will come to the River. We need 
> more publications regarding this project. In order to do that
> students are the great source.  Recently, we published a discussion 
> paper from Japan that utilize River. I attach here for your reference.
> There was great feedback on it. I hope you will consider to keep it 
> for the time being and see the progress.
>  I am ready to contribute to promote this project. For your reference, 
> here is the paper that we published. We are preparing
> next paper that shows the potential of River to integrate with other 
> technologies so that more users will understand how to utilize this 
> technology.
>
> Bishnu Prasad Gautam
> ------------------------------------------------------------------------
> *From:* Peter Firmstone <pe...@zeus.net.au>
> *Sent:* Thursday, February 10, 2022 12:12 AM
> *To:* dev@river.apache.org <de...@river.apache.org>
> *Subject:* Re: [DISCUSS] Moving Apache River to the Attic
> Even in the Attic, River will remain a valuable resource of information.
>
> When OpenJDK published JEP411 in April 2021, they believed what we were
> already doing with River was impossible, which succinctly sums up a
> number of River's features.
>
> https://mail.openjdk.java.net/pipermail/security-dev/2021-May/thread.html
>
> > >/Lets be clear Java will no longer be able to finely control access to
> > sensitive data with the removal of SecurityManager. I'm sure it will
> > be a great bonus for OpenJDK dev's not to have to think about, but it
> > will impact some developers significantly, who would like to do so
> > with the least suffering possible. /
> > I wouldn’t say Java (or anything else, for that matter) is “able" to 
> do it now, except in the sense that people (scientists) are
> > able (in a billion-dollar particle accelerator) to transmute lead 
> into gold (a few atoms). We’ve had twenty five years to convince the 
> world this could work, the world isn’t buying, and our job isn’t to 
> sell ideas but to serve millions of developers by giving them
> > what we believe they need now, not what we wished they wanted.
>
> OpenJDK's arguments around SMs poor scalability, poor performance etc,
> only applied to the unloved provider code shipped with OpenJDK, (hardly
> changed since Java 1.4), they were proven wrong on every account, except
> for development cost; maintaining Security had a cost, they were right
> about that, and OpenJDK no longer wished to bear that cost for a small
> uptake.   For example we are not vulnerable to the recent Log4j
> vulnerability, even when using the logger, provided SecurityManager is
> enabled with tool generated principle of least privilege policy files.
> Parts of OpenJDK didn't make use of SecurityManager, eg data parsing
> (deserialization) and OpenJDKs trusted codebase became too large, when
> it should have been restricted to the Java core language features (too
> much Java platform code has AllPermission).
>
> While OpenJDK might have learned from River, they chose not to, perhaps
> things might have been different had some of the original team
> remained.  Perhaps Jini's original vision might be commercially viable
> today had Oracle reconsidered it and the role Java was intended for.
>
> The challenges River as a project faced:
>
>   * Challenges for new developers:
>       o The large monolithic build, new developers struggled to
>         understand how River worked under the hood, they couldn't see
>         the forest for the trees.   River / Jini also had many layers of
>         indirection, a result of its well designed architecture.
>       o Classdepandjar - a unique dependency based build that, while
>         innovative in its time, was confusing to new developers and
>         modern modular frameworks provided better solutions.
>   * Technical challenges for users:
>       o Codebase annotation loss and ClassLoader resolution problems,
>         relating to flaws in the design of Java Serialization, that
>         River / Jini was forced to plaster over.
>       o IPv4 network address translation had relegated River / Jini to
>         private networks, limiting its appeal in the age of the internet.
>       o TLS, HTTPS & Kerberos transport layers were configurable
>         replacements, but event notifications stopped working. Events
>         are a pretty important feature.
>       o How to integrate with modular frameworks, eg Maven or OSGi.
>       o These historical technical challenges were solved outside of the
>         project.
>   * Disagreements on technical solutions, no doubt due to different
>     understandings or experiences and complexity (OSGi integration
>     caused a lot of contention).
>   * Many developers maintained their own forks of Jini / River, to solve
>     problems they needed to make something work, but it was never
>     standardized or agreed upon and it was difficult the merge the
>     changes back, even when in agreement, it was a big undertaking due
>     to River's use of SVN and large monolithic build.
>
> River's complexity came from making the impossible, possible. When your
> process involves turning lead into gold in your billion dollar particle
> accelerator, you have to accept there will be some difficulties and
> disagreements among the boffins.  Maybe cat herding might have been
> easier.   But hey, it was fun.
>
> Cheers,
>
> Peter.
>
> On 10/02/2022 1:34 am, Dan Rollo wrote:
> > I agree it is time.
> >
> > Well said Jeremy! Thanks for sharing.
> > I have fond memories of Jini conferences in Chicago and Brussels 
> (even if all I remember is the Delirium Cafe).
> >
> > Dan Rollo
> >
> >
> >> On Feb 9, 2022, at 10:03 AM, Jeremy R. 
> Easton-Marks<J....@gmail.com>  wrote:
> >>
> >> I, sadly, agree that it is time to move this project to the Attic. 
> While I
> >> hoped to work on this as a side project, I have not been able to 
> carve out
> >> time for it. While I do think this project has a lot of potential, 
> without
> >> some type of sponsorship in time and resources I don't see it moving
> >> forward. Thank you Roy for stepping up as the chair as well as the 
> rest of
> >> the River team for contributing to this project over the years. It 
> has been
> >> great watching the discussions in these threads.
> >>
> >> On a personal note, seeing this project move into the Attic while 
> sad, it
> >> will hopefully be cathartic. My father, Peter C. Marks, was one of the
> >> original developers at Sun who worked on Jini. I remember him being 
> very
> >> excited about the potential for the technology and he enjoyed 
> demoing it. I
> >> even remember accompanying him to Amsterdam to demo it at a 
> conference when
> >> I was younger. I have some of the original Jini books sitting in my 
> office
> >> right now that have been signed by some of the original team members.
> >>
> >> I had hoped to see the project keep going, maybe with it moving 
> into the
> >> Attic River can move forward in a different way.
> >>
> >> On Mon, Feb 7, 2022 at 6:41 PM Roy T. Fielding<fi...@gbiv.com>  
> wrote:
> >>
> >>> Hello everyone,
> >>>
> >>> It's that time of year when I try to figure out what I am doing and
> >>> what I am not, and try to cut back on the stuff that seems unlikely
> >>> to succeed. I suspect the same is true of others.
> >>>
> >>> I had hoped that more new people at River would result in more 
> activity,
> >>> but that hasn't occurred over the past 9 months and doesn't seem 
> likely
> >>> in the future. Aside from ASF echoes and Infra-driven website 
> replacement,
> >>> there has been nothing to report about River the entire time that 
> I have
> >>> been the chair pro tem, and there hasn't been any chatter by users 
> either.
> >>>
> >>> Please feel free to let me know if I am missing something.
> >>>
> >>> If not, I'd like us to accept the reality of this situation and 
> move the
> >>> River project to the Attic. The code will still be available 
> there, and
> >>> folks are welcome to copy it under the license, move it to Github, or
> >>> otherwise seek to re-mold it into a collaborative project wherever is
> >>> most convenient for them.
> >>>
> >>> Cheers,
> >>>
> >>> ....Roy
> >>>
> >>>
> >> --
> >> Jeremy R. Easton-Marks
> >>
> >> "être fort pour être utile"

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Bishnu Gautam <bi...@hotmail.com>.
Hi River Team

I am an occasional user/developer of JINI and River. Here are my thoughts on this project.
Since last summer I am using River to educate my seminar students to learn the concept of distributed computing by using River.
A couple of students are already working to integrate River with other technologies to cross the NAT and other limitations of
private network. For example, you can use the technique of UDP hole punching integrating with STUN server to address that problem
as Peter mentioned. We already have the clear solution for that River is facing on which we are working now.
I am even thinking to introduce the River from next year as a formal course for my seminar students (as a sub project) seeing the potential
of this project.
I think it is too early to decide to move it to Attic as there are some users as of me and my students.
Instead of moving this project to the corner, why not some of us introduce a working example/or a killer application so that a lots of users
will have attention on it. Users have difficulties to understand the architecture and how to integrated this architecture to other technology.
Once we clearly show it, more users will come to the River. We need more publications regarding this project. In order to do that
students are the great source.  Recently, we published a discussion paper from Japan that utilize River. I attach here for your reference.
There was great feedback on it. I hope you will consider to keep it for the time being and see the progress.
 I am ready to contribute to promote this project. For your reference, here is the paper that we published. We are preparing
next paper that shows the potential of River to integrate with other technologies so that more users will understand how to utilize this technology.

Bishnu Prasad Gautam
________________________________
From: Peter Firmstone <pe...@zeus.net.au>
Sent: Thursday, February 10, 2022 12:12 AM
To: dev@river.apache.org <de...@river.apache.org>
Subject: Re: [DISCUSS] Moving Apache River to the Attic

Even in the Attic, River will remain a valuable resource of information.

When OpenJDK published JEP411 in April 2021, they believed what we were
already doing with River was impossible, which succinctly sums up a
number of River's features.

https://mail.openjdk.java.net/pipermail/security-dev/2021-May/thread.html

> >/Lets be clear Java will no longer be able to finely control access to
> sensitive data with the removal of SecurityManager. I'm sure it will
> be a great bonus for OpenJDK dev's not to have to think about, but it
> will impact some developers significantly, who would like to do so
> with the least suffering possible. /
> I wouldn’t say Java (or anything else, for that matter) is “able" to do it now, except in the sense that people (scientists) are
> able (in a billion-dollar particle accelerator) to transmute lead into gold (a few atoms). We’ve had twenty five years to convince the world this could work, the world isn’t buying, and our job isn’t to sell ideas but to serve millions of developers by giving them
> what we believe they need now, not what we wished they wanted.

OpenJDK's arguments around SMs poor scalability, poor performance etc,
only applied to the unloved provider code shipped with OpenJDK, (hardly
changed since Java 1.4), they were proven wrong on every account, except
for development cost; maintaining Security had a cost, they were right
about that, and OpenJDK no longer wished to bear that cost for a small
uptake.   For example we are not vulnerable to the recent Log4j
vulnerability, even when using the logger, provided SecurityManager is
enabled with tool generated principle of least privilege policy files.
Parts of OpenJDK didn't make use of SecurityManager, eg data parsing
(deserialization) and OpenJDKs trusted codebase became too large, when
it should have been restricted to the Java core language features (too
much Java platform code has AllPermission).

While OpenJDK might have learned from River, they chose not to, perhaps
things might have been different had some of the original team
remained.  Perhaps Jini's original vision might be commercially viable
today had Oracle reconsidered it and the role Java was intended for.

The challenges River as a project faced:

  * Challenges for new developers:
      o The large monolithic build, new developers struggled to
        understand how River worked under the hood, they couldn't see
        the forest for the trees.   River / Jini also had many layers of
        indirection, a result of its well designed architecture.
      o Classdepandjar - a unique dependency based build that, while
        innovative in its time, was confusing to new developers and
        modern modular frameworks provided better solutions.
  * Technical challenges for users:
      o Codebase annotation loss and ClassLoader resolution problems,
        relating to flaws in the design of Java Serialization, that
        River / Jini was forced to plaster over.
      o IPv4 network address translation had relegated River / Jini to
        private networks, limiting its appeal in the age of the internet.
      o TLS, HTTPS & Kerberos transport layers were configurable
        replacements, but event notifications stopped working. Events
        are a pretty important feature.
      o How to integrate with modular frameworks, eg Maven or OSGi.
      o These historical technical challenges were solved outside of the
        project.
  * Disagreements on technical solutions, no doubt due to different
    understandings or experiences and complexity (OSGi integration
    caused a lot of contention).
  * Many developers maintained their own forks of Jini / River, to solve
    problems they needed to make something work, but it was never
    standardized or agreed upon and it was difficult the merge the
    changes back, even when in agreement, it was a big undertaking due
    to River's use of SVN and large monolithic build.

River's complexity came from making the impossible, possible. When your
process involves turning lead into gold in your billion dollar particle
accelerator, you have to accept there will be some difficulties and
disagreements among the boffins.  Maybe cat herding might have been
easier.   But hey, it was fun.

Cheers,

Peter.

On 10/02/2022 1:34 am, Dan Rollo wrote:
> I agree it is time.
>
> Well said Jeremy! Thanks for sharing.
> I have fond memories of Jini conferences in Chicago and Brussels (even if all I remember is the Delirium Cafe).
>
> Dan Rollo
>
>
>> On Feb 9, 2022, at 10:03 AM, Jeremy R. Easton-Marks<J....@gmail.com>  wrote:
>>
>> I, sadly, agree that it is time to move this project to the Attic. While I
>> hoped to work on this as a side project, I have not been able to carve out
>> time for it. While I do think this project has a lot of potential, without
>> some type of sponsorship in time and resources I don't see it moving
>> forward. Thank you Roy for stepping up as the chair as well as the rest of
>> the River team for contributing to this project over the years. It has been
>> great watching the discussions in these threads.
>>
>> On a personal note, seeing this project move into the Attic while sad, it
>> will hopefully be cathartic. My father, Peter C. Marks, was one of the
>> original developers at Sun who worked on Jini. I remember him being very
>> excited about the potential for the technology and he enjoyed demoing it. I
>> even remember accompanying him to Amsterdam to demo it at a conference when
>> I was younger. I have some of the original Jini books sitting in my office
>> right now that have been signed by some of the original team members.
>>
>> I had hoped to see the project keep going, maybe with it moving into the
>> Attic River can move forward in a different way.
>>
>> On Mon, Feb 7, 2022 at 6:41 PM Roy T. Fielding<fi...@gbiv.com>  wrote:
>>
>>> Hello everyone,
>>>
>>> It's that time of year when I try to figure out what I am doing and
>>> what I am not, and try to cut back on the stuff that seems unlikely
>>> to succeed. I suspect the same is true of others.
>>>
>>> I had hoped that more new people at River would result in more activity,
>>> but that hasn't occurred over the past 9 months and doesn't seem likely
>>> in the future. Aside from ASF echoes and Infra-driven website replacement,
>>> there has been nothing to report about River the entire time that I have
>>> been the chair pro tem, and there hasn't been any chatter by users either.
>>>
>>> Please feel free to let me know if I am missing something.
>>>
>>> If not, I'd like us to accept the reality of this situation and move the
>>> River project to the Attic. The code will still be available there, and
>>> folks are welcome to copy it under the license, move it to Github, or
>>> otherwise seek to re-mold it into a collaborative project wherever is
>>> most convenient for them.
>>>
>>> Cheers,
>>>
>>> ....Roy
>>>
>>>
>> --
>> Jeremy R. Easton-Marks
>>
>> "être fort pour être utile"

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
Even in the Attic, River will remain a valuable resource of information.

When OpenJDK published JEP411 in April 2021, they believed what we were 
already doing with River was impossible, which succinctly sums up a 
number of River's features.

https://mail.openjdk.java.net/pipermail/security-dev/2021-May/thread.html

> >/Lets be clear Java will no longer be able to finely control access to 
> sensitive data with the removal of SecurityManager. I'm sure it will 
> be a great bonus for OpenJDK dev's not to have to think about, but it 
> will impact some developers significantly, who would like to do so 
> with the least suffering possible. /
> I wouldn’t say Java (or anything else, for that matter) is “able" to do it now, except in the sense that people (scientists) are
> able (in a billion-dollar particle accelerator) to transmute lead into gold (a few atoms). We’ve had twenty five years to convince the world this could work, the world isn’t buying, and our job isn’t to sell ideas but to serve millions of developers by giving them
> what we believe they need now, not what we wished they wanted.

OpenJDK's arguments around SMs poor scalability, poor performance etc, 
only applied to the unloved provider code shipped with OpenJDK, (hardly 
changed since Java 1.4), they were proven wrong on every account, except 
for development cost; maintaining Security had a cost, they were right 
about that, and OpenJDK no longer wished to bear that cost for a small 
uptake.   For example we are not vulnerable to the recent Log4j 
vulnerability, even when using the logger, provided SecurityManager is 
enabled with tool generated principle of least privilege policy files.   
Parts of OpenJDK didn't make use of SecurityManager, eg data parsing 
(deserialization) and OpenJDKs trusted codebase became too large, when 
it should have been restricted to the Java core language features (too 
much Java platform code has AllPermission).

While OpenJDK might have learned from River, they chose not to, perhaps 
things might have been different had some of the original team 
remained.  Perhaps Jini's original vision might be commercially viable 
today had Oracle reconsidered it and the role Java was intended for.

The challenges River as a project faced:

  * Challenges for new developers:
      o The large monolithic build, new developers struggled to
        understand how River worked under the hood, they couldn't see
        the forest for the trees.   River / Jini also had many layers of
        indirection, a result of its well designed architecture.
      o Classdepandjar - a unique dependency based build that, while
        innovative in its time, was confusing to new developers and
        modern modular frameworks provided better solutions.
  * Technical challenges for users:
      o Codebase annotation loss and ClassLoader resolution problems,
        relating to flaws in the design of Java Serialization, that
        River / Jini was forced to plaster over.
      o IPv4 network address translation had relegated River / Jini to
        private networks, limiting its appeal in the age of the internet.
      o TLS, HTTPS & Kerberos transport layers were configurable
        replacements, but event notifications stopped working. Events
        are a pretty important feature.
      o How to integrate with modular frameworks, eg Maven or OSGi.
      o These historical technical challenges were solved outside of the
        project.
  * Disagreements on technical solutions, no doubt due to different
    understandings or experiences and complexity (OSGi integration
    caused a lot of contention).
  * Many developers maintained their own forks of Jini / River, to solve
    problems they needed to make something work, but it was never
    standardized or agreed upon and it was difficult the merge the
    changes back, even when in agreement, it was a big undertaking due
    to River's use of SVN and large monolithic build.

River's complexity came from making the impossible, possible. When your 
process involves turning lead into gold in your billion dollar particle 
accelerator, you have to accept there will be some difficulties and 
disagreements among the boffins.  Maybe cat herding might have been 
easier.   But hey, it was fun.

Cheers,

Peter.

On 10/02/2022 1:34 am, Dan Rollo wrote:
> I agree it is time.
>
> Well said Jeremy! Thanks for sharing.
> I have fond memories of Jini conferences in Chicago and Brussels (even if all I remember is the Delirium Cafe).
>
> Dan Rollo
>
>
>> On Feb 9, 2022, at 10:03 AM, Jeremy R. Easton-Marks<J....@gmail.com>  wrote:
>>
>> I, sadly, agree that it is time to move this project to the Attic. While I
>> hoped to work on this as a side project, I have not been able to carve out
>> time for it. While I do think this project has a lot of potential, without
>> some type of sponsorship in time and resources I don't see it moving
>> forward. Thank you Roy for stepping up as the chair as well as the rest of
>> the River team for contributing to this project over the years. It has been
>> great watching the discussions in these threads.
>>
>> On a personal note, seeing this project move into the Attic while sad, it
>> will hopefully be cathartic. My father, Peter C. Marks, was one of the
>> original developers at Sun who worked on Jini. I remember him being very
>> excited about the potential for the technology and he enjoyed demoing it. I
>> even remember accompanying him to Amsterdam to demo it at a conference when
>> I was younger. I have some of the original Jini books sitting in my office
>> right now that have been signed by some of the original team members.
>>
>> I had hoped to see the project keep going, maybe with it moving into the
>> Attic River can move forward in a different way.
>>
>> On Mon, Feb 7, 2022 at 6:41 PM Roy T. Fielding<fi...@gbiv.com>  wrote:
>>
>>> Hello everyone,
>>>
>>> It's that time of year when I try to figure out what I am doing and
>>> what I am not, and try to cut back on the stuff that seems unlikely
>>> to succeed. I suspect the same is true of others.
>>>
>>> I had hoped that more new people at River would result in more activity,
>>> but that hasn't occurred over the past 9 months and doesn't seem likely
>>> in the future. Aside from ASF echoes and Infra-driven website replacement,
>>> there has been nothing to report about River the entire time that I have
>>> been the chair pro tem, and there hasn't been any chatter by users either.
>>>
>>> Please feel free to let me know if I am missing something.
>>>
>>> If not, I'd like us to accept the reality of this situation and move the
>>> River project to the Attic. The code will still be available there, and
>>> folks are welcome to copy it under the license, move it to Github, or
>>> otherwise seek to re-mold it into a collaborative project wherever is
>>> most convenient for them.
>>>
>>> Cheers,
>>>
>>> ....Roy
>>>
>>>
>> -- 
>> Jeremy R. Easton-Marks
>>
>> "être fort pour être utile"

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Dan Rollo <da...@gmail.com>.
I agree it is time.

Well said Jeremy! Thanks for sharing.
I have fond memories of Jini conferences in Chicago and Brussels (even if all I remember is the Delirium Cafe).

Dan Rollo


> On Feb 9, 2022, at 10:03 AM, Jeremy R. Easton-Marks <J....@gmail.com> wrote:
> 
> I, sadly, agree that it is time to move this project to the Attic. While I
> hoped to work on this as a side project, I have not been able to carve out
> time for it. While I do think this project has a lot of potential, without
> some type of sponsorship in time and resources I don't see it moving
> forward. Thank you Roy for stepping up as the chair as well as the rest of
> the River team for contributing to this project over the years. It has been
> great watching the discussions in these threads.
> 
> On a personal note, seeing this project move into the Attic while sad, it
> will hopefully be cathartic. My father, Peter C. Marks, was one of the
> original developers at Sun who worked on Jini. I remember him being very
> excited about the potential for the technology and he enjoyed demoing it. I
> even remember accompanying him to Amsterdam to demo it at a conference when
> I was younger. I have some of the original Jini books sitting in my office
> right now that have been signed by some of the original team members.
> 
> I had hoped to see the project keep going, maybe with it moving into the
> Attic River can move forward in a different way.
> 
> On Mon, Feb 7, 2022 at 6:41 PM Roy T. Fielding <fi...@gbiv.com> wrote:
> 
>> Hello everyone,
>> 
>> It's that time of year when I try to figure out what I am doing and
>> what I am not, and try to cut back on the stuff that seems unlikely
>> to succeed. I suspect the same is true of others.
>> 
>> I had hoped that more new people at River would result in more activity,
>> but that hasn't occurred over the past 9 months and doesn't seem likely
>> in the future. Aside from ASF echoes and Infra-driven website replacement,
>> there has been nothing to report about River the entire time that I have
>> been the chair pro tem, and there hasn't been any chatter by users either.
>> 
>> Please feel free to let me know if I am missing something.
>> 
>> If not, I'd like us to accept the reality of this situation and move the
>> River project to the Attic. The code will still be available there, and
>> folks are welcome to copy it under the license, move it to Github, or
>> otherwise seek to re-mold it into a collaborative project wherever is
>> most convenient for them.
>> 
>> Cheers,
>> 
>> ....Roy
>> 
>> 
> 
> -- 
> Jeremy R. Easton-Marks
> 
> "être fort pour être utile"


Re: [DISCUSS] Moving Apache River to the Attic

Posted by "Jeremy R. Easton-Marks" <J....@gmail.com>.
I, sadly, agree that it is time to move this project to the Attic. While I
hoped to work on this as a side project, I have not been able to carve out
time for it. While I do think this project has a lot of potential, without
some type of sponsorship in time and resources I don't see it moving
forward. Thank you Roy for stepping up as the chair as well as the rest of
the River team for contributing to this project over the years. It has been
great watching the discussions in these threads.

On a personal note, seeing this project move into the Attic while sad, it
will hopefully be cathartic. My father, Peter C. Marks, was one of the
original developers at Sun who worked on Jini. I remember him being very
excited about the potential for the technology and he enjoyed demoing it. I
even remember accompanying him to Amsterdam to demo it at a conference when
I was younger. I have some of the original Jini books sitting in my office
right now that have been signed by some of the original team members.

I had hoped to see the project keep going, maybe with it moving into the
Attic River can move forward in a different way.

On Mon, Feb 7, 2022 at 6:41 PM Roy T. Fielding <fi...@gbiv.com> wrote:

> Hello everyone,
>
> It's that time of year when I try to figure out what I am doing and
> what I am not, and try to cut back on the stuff that seems unlikely
> to succeed. I suspect the same is true of others.
>
> I had hoped that more new people at River would result in more activity,
> but that hasn't occurred over the past 9 months and doesn't seem likely
> in the future. Aside from ASF echoes and Infra-driven website replacement,
> there has been nothing to report about River the entire time that I have
> been the chair pro tem, and there hasn't been any chatter by users either.
>
> Please feel free to let me know if I am missing something.
>
> If not, I'd like us to accept the reality of this situation and move the
> River project to the Attic. The code will still be available there, and
> folks are welcome to copy it under the license, move it to Github, or
> otherwise seek to re-mold it into a collaborative project wherever is
> most convenient for them.
>
> Cheers,
>
> ....Roy
>
>

-- 
Jeremy R. Easton-Marks

"être fort pour être utile"

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Michał Kłeczek <mi...@kleczek.org>.
Follow up:

> On 15 Feb 2022, at 13:05, Peter Firmstone <pe...@zeus.net.au> wrote:
> 
> 
>> 
>> - How do you provide the above mentioned JavaSpaceEventPublisher
>> - How would you provide a java.sql.DataSource as a service?
> 
> 
> If you don't have an ObjectEndpoint, then there is no one to authenticate, you only have bytes to de-serialize, so how do you establish trust, ie who did the bytes come from?  However it is possible to have a service that has an ObjectEndpoint and only uses it for authentication of the proxy serializer and codebase provisioning after which the deserialized bytes become objects and don't make remote method calls.  I think that would be an acceptable alternative; someone needs to vouch for the serialized bytes.

You still need to load code to be able to deserialise.
How do you do that in your solution?

> 
> 
>> 
>>> Now the proxy serializer is itself a service (bootstrap proxy), that is authenticated when using secure endpoints.  You could quite easily add an interface to the proxy serializer to return your object annotation.
>>> 
>>> Note that I use a string, because I also use it in secure multicast discovery protocols (typically IPv6), which don't include objects, for authentication and provisioning a ClassLoader for a lookup service proxy prior to any Object de-serialization.
>>> 
>>> https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml <https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml>
>>> 
>>> Summing up to simplify JGDMS and solve some very difficult issues, it had to give up:
>>> 
>>> 1. Support for circular references in serialized object graphs, was
>>>    dropped.
>>> 
>> My solution supports any object graph.
> 
> 
> What capability do you need circular references for? 

This is besides the point.
The point is that code loading should be orthogonal to serialisation format an whether it supports circular references.

[...]
>> 
>> It would be great to be able to merge the ideas and work on common solution.
>> The question is whether it should be Apache River project…
> 
> 
> I think the PMC has already decided River's fate, and I tend to agree with their decision, the problem is that historically, it hasn't been possible to innovate inside the Apache River project, innovation has been forced to happen elsewhere and it wasn't just what I was doing, there was an attempt to do some container work in River but that also got shut down.  People had trouble in the past agreeing on Rivers direction and there are no currently active developers.   It is still possible to get a group of people together to create an Apache project, but I don't think the code needs it.   github and other sites like it are better for loose collaboration, where developers can feed off each others ideas and innovations and the best solutions survive.

I am with you here.

Michal

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
Some final thoughts on using OSGi with Jini.

https://www.artima.com/weblogs/viewpost.jsp?thread=202304

This was always a contentious issue historically on Jini lists, I expect 
there will be vastly differing opinions on the subject, so I haven't 
made any decisions that would constrain developers options to any 
particular framework.   While I respectfully disagree with most of 
Michał's assessments and opinions regarding JGDMS on this occasion, I 
haven't made any changes that would prevent him from marshaling Objects, 
ClassLoaders or bytecode to replace codebase annotations in streams.  I 
still respect that Michał has an inquiring mind and is willing to 
experiment with some very complex issues.

Work to support OSGi in JGDMS is ongoing and doesn't require developers 
to install or use OSGi.

To dispel any confusion that might have arisen as a result of this 
discussion, and for anyone reading the email archives, JGDMS avoids 
annotating marshaling streams with codebase strings and uses a 
CodebaseAccessor service instead, which also provides signer 
certificates, not just space separated URI strings, these certificates 
may be self signed, they are dynamically granted permission as they have 
come from an authenticated service via a secure connection.   
CodebaseAccessor is also used to authenticate the service, prior to 
unmarshaling its proxy.   ProxyCodebaseSpi allows you to use the modular 
framework of your choice for the provisioning of ClassLoaders and wiring 
of their dependencies, CodebaseAccessor provides information about the 
proxy's codebase requirements prior to its unmarshaling.   Atomic 
marshaling streams make no assumptions about the module structures of 
systems at either endpoint.   The atomic marshal stream only requires 
that identical proxy codebases are loaded at either endpoint, that is 
all, so that all classes the service uses will be resolved by the 
ClassLoader at the remote endpoint.  This is why all services are given 
their own independent marshaling streams to manage class visibility and 
avoid incorrect class resolution, which results in codebase annotation 
loss.  This is why I am not using the atomic marshaling framework to 
control or dictate ClassLoader hierarchies, and allow it instead to only 
focus on marshaling and unmarshaling object bytes securely.

This also solves a long standing issue with unmarshaling in OSGi.  Now 
OSGi (or other frameworks) can manage class resolution, rather than the 
object marshaling framework taking on this responsbility and trying to 
replicate the functionality of each or forcing developers to chose.   
Marshaling objects has been uncoupled from class resolution in JGDMS.  
The ClassLoader is only assigned once to the Endpoint, from that point 
on, all class resolution decisions are made by the ClassLoader.  This is 
unlike Jini and RMI marshalling of codebase annotations, where an 
attempt is made for each class to find its ClassLoader using stream 
annotations, if present during unmarshaling.

This work has taken many years to complete and a lot of research has 
gone into the decision making process.

JGDMS is modular and all jar file artifacts are also OSGi bundles.  
AtomicILFactory, uses ClassLoaders at Endpoints, doesnt utilise the 
thread context ClassLoader, making it more compatible with modular 
frameworks.

JGDMS provides a RFC 3986 compliant URI that supports RFC 5952 
normalization of IPv6 addresses, this provides a huge performance 
benefit, as DNS calls are not required to check for address equality.  I 
am still using space separated URI strings for codebases.   This URI 
class is not serializable, parsing URI strings instead is good security 
practice. 
https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/org/apache/river/api/net/Uri.java

One of the problems that I am currently working on in the support of 
OSGi, is that of proxy identity, there are many proxies that use the 
same bundle version, eg all common services, and these have static 
fields that shouldn't be shared among global providers.   For example 
different lookup services from different providers on the internet 
shouldn't share implementation classes.

I am currently investigating using Apache Aries and OSGi subsystems, so 
that service proxies remain independent and isolated from each other 
when utilizing OSGi as the underlying framework only cooperating on 
service API.   It is a non goal to make incompatible versions of Service 
APIs interoperate, for example if someone changes an Entry in a way that 
breaks compatibility, then I expect that it will use a different non 
compatible service version, and these will be considered different services.

Any assistance from anyone who is familiar with OSGi and Jini, would be 
much appreciated.

Regards,

Peter.

On 16/02/2022 9:32 pm, Peter Firmstone wrote:
> Hi Michał,
>
> I didn't take it personal, and don't expect you to take it personal 
> either when I say, I'm pretty sure everyone here is aware of River / 
> Jini limitations.
>
> Anyway River has been a lot of fun, all the best for the future 
> everyone, hope to see you around from time to time.
>
> Cheers,
>
> Peter.
>
> On 16/02/2022 7:53 pm, Michał Kłeczek wrote:
>> Hi Peter,
>>
>>> On 16 Feb 2022, at 10:01, Peter Firmstone 
>>> <pe...@zeus.net.au> wrote:
>>>
>>> Inline below.
>>>
>>> On 16/02/2022 5:24 pm, Michał Kłeczek wrote:
>>>>
>>>>> On 16 Feb 2022, at 04:25, Peter Firmstone 
>>>>> <pe...@zeus.net.au> wrote:
>>>>>
>>>>> From the CodebaseAccessor service.
>>>>>
>>>>> The CodebaseAccessor proxy (local code) is passed as a parameter 
>>>>> along with a MarshalledInstance of the proxy, by ProxySerializer 
>>>>> to ProxyCodebaseSpi.
>>>>>
>>>>> https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java 
>>>>> <https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java> 
>>>>>
>>>> Ok, so you have introduced a level of indirection to retrieve 
>>>> String codebase annotations. Why not go one step further and 
>>>> instead of:
>>>>
>>>> interface CodebaseAccessor {
>>>>   String getClassAnnotation() throws IOException;
>>>> }
>>>>
>>>> have something along the lines of (conceptually):
>>>>
>>>> interface Codebase extends RemoteMethodControl {
>>>>   ClassLoader getClassLoader() throws IOException;
>>>> }
>>>
>>>
>>> I personally wouldn't take this step, because CodebaseAccessor is a 
>>> Remote interface and ClassLoader is a class of high privilege, so it 
>>> presents a security risk.
>>
>> Not really as implementation is constrained by the same security 
>> rules as any other code: you can constrain it via policy that only 
>> grants create ClassLoader permission to specific implementations.
>>
>>>> See above:
>>>> you can move this code from the client to the service and let it 
>>>> provide the implementation of class resolution algorithm.
>>>
>>>
>>> I would advise against that, the remote service JVM knows little 
>>> about the client JVM, both are likely to have completely different 
>>> ClassLoader hierarchies.
>>
>> To be able to communicate they have to understand each other class 
>> loading mechanism anyway.
>> In particular the class annotation String syntax and semantics has to 
>> be the same for both.
>>
>> [...]
>>>
>>>>>
>>>>> If using OSGi, OSGi will resolve the required dependencies and 
>>>>> download them if not already present on the client, OSGi will give 
>>>>> preference if a compatible version of the bundle dependencies 
>>>>> already loaded at the client.   If using preferred classes the 
>>>>> preferred class list will determine the order of preference, 
>>>>> whether classes are loaded from the proxy codebase or the client 
>>>>> ClassLoader (the parent loader of the proxy ClassLoader) first.
>>>> I also tried this route and it is a dead end because
>>>>
>>>> * it is not possible to statically (ie. as part of the software 
>>>> package like OSGi manifest) provide dependency resolution 
>>>> constraints to be able to exchange arbitrarily constructed object 
>>>> graphs *
>>>
>>>
>>> This is a limitation and compromise I have accepted, JGDMS doesn't 
>>> attempt to load arbitrarily constructed object graphs, instead it 
>>> ensures that both endpoints of a Service have the same class 
>>> resolution view, the same proxy bundle version is used at the Server 
>>> and client.
>>
>> This breaks once there are multiple parties (services) involved 
>> because it means _all_ of them have to have their software versions 
>> synchronised in advance - which in turn makes the excercise moot: if 
>> you have to do that there is no need for mobile code anymore.
>> What is really IMHO needed is a practical way of independent 
>> evolution of system components.
>>
>>> At the server, the proxy bundle is depended upon by the service 
>>> implementation, but  nothing at the client depends upon the proxy 
>>> bundle loaded there, instead the proxy bundle depends on the api 
>>> loaded by the client. That is why JGDMS discourages marshaling of 
>>> client subclasses that override service method parameter classes, 
>>> because they cannot be exported as remote objects and are subject to 
>>> codebase annotation loss and class resolution problems.
>>
>> There is no subclassing in my example of RemoteEventSpacePublisher.
>>
>>> Sometimes, less is more, I've chosen this compromise in this 
>>> instance to avoid complexity.  I saw little to be gained from the 
>>> added complexity, it can be worked around by improving service api 
>>> design and practices.
>>
>> It cannot. How would you improve RemoteEventListener or JavaSpace API 
>> to avoid these issues?
>>
>>>   Instead the client can export method parameter interface types as 
>>> remote objects, with independent ClassLoader visibility, that will 
>>> resolve to common super interface types.
>>>
>>> If there is a versioning problem at the client, where it uses an 
>>> incompatible API with the client, ServiceDiscoveryManager will 
>>> recognise the service is the incorrect type and discard it.
>>
>> The whole point of my example is that this is not the issue of 
>> compatibility between client and service interface but it is inherent 
>> to existing class loading mechanism.
>>
>>>
>>> I recognise my own limitations, I'm not smart enough to solve the 
>>> problems of de-serialization of arbitrary object graphs,
>>> so I have left it as a task for someone either smarter or more 
>>> determined than myself and focused on what I believe is an 
>>> acceptable and reliable compromise. It is because of my own 
>>> limitations, that I reduced complexity, so that I (as well as 
>>> inexperienced users) didn't have to worry about codebase annotation 
>>> loss or class resolution issues.
>>>
>>> I'm not saying it can't be solved, or that you won't succeed, simply 
>>> that after a lot of thought, I decided it would be easier to reduce 
>>> complexity and accept some limitations as this seems like the best 
>>> compromise, there are also other things which have a higher priority 
>>> for my time.
>>
>> It wasn’t my intent to make this really interesting technical 
>> discussion personal but rather try to discuss the limitations of 
>> Jini/River and the possible directions.
>>
>> I personally find the idea of mobile objects really interesting and 
>> very influential to the way how systems are implemented.
>> Having a single uniform way of exchanging both code and data opens up 
>> a lot of possibilities.
>>
>> Think of loggers being services implemented by mobile objects that 
>> can be replaced with new versions easily - log4shell would not be 
>> such a huge nightmare to handle.
>>
>> What’s more - mobile code is something you are doing anyway - but in 
>> an ad-hoc ways that are incompatible with each other.
>>
>> Michal 
>

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
Hi Michał,

I didn't take it personal, and don't expect you to take it personal 
either when I say, I'm pretty sure everyone here is aware of River / 
Jini limitations.

Anyway River has been a lot of fun, all the best for the future 
everyone, hope to see you around from time to time.

Cheers,

Peter.

On 16/02/2022 7:53 pm, Michał Kłeczek wrote:
> Hi Peter,
>
>> On 16 Feb 2022, at 10:01, Peter Firmstone 
>> <pe...@zeus.net.au> wrote:
>>
>> Inline below.
>>
>> On 16/02/2022 5:24 pm, Michał Kłeczek wrote:
>>>
>>>> On 16 Feb 2022, at 04:25, Peter Firmstone 
>>>> <pe...@zeus.net.au> wrote:
>>>>
>>>> From the CodebaseAccessor service.
>>>>
>>>> The CodebaseAccessor proxy (local code) is passed as a parameter 
>>>> along with a MarshalledInstance of the proxy, by ProxySerializer to 
>>>> ProxyCodebaseSpi.
>>>>
>>>> https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java 
>>>> <https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java>
>>> Ok, so you have introduced a level of indirection to retrieve String 
>>> codebase annotations. Why not go one step further and instead of:
>>>
>>> interface CodebaseAccessor {
>>>   String getClassAnnotation() throws IOException;
>>> }
>>>
>>> have something along the lines of (conceptually):
>>>
>>> interface Codebase extends RemoteMethodControl {
>>>   ClassLoader getClassLoader() throws IOException;
>>> }
>>
>>
>> I personally wouldn't take this step, because CodebaseAccessor is a 
>> Remote interface and ClassLoader is a class of high privilege, so it 
>> presents a security risk.
>
> Not really as implementation is constrained by the same security rules 
> as any other code: you can constrain it via policy that only grants 
> create ClassLoader permission to specific implementations.
>
>>> See above:
>>> you can move this code from the client to the service and let it 
>>> provide the implementation of class resolution algorithm.
>>
>>
>> I would advise against that, the remote service JVM knows little 
>> about the client JVM, both are likely to have completely different 
>> ClassLoader hierarchies.
>
> To be able to communicate they have to understand each other class 
> loading mechanism anyway.
> In particular the class annotation String syntax and semantics has to 
> be the same for both.
>
> [...]
>>
>>>>
>>>> If using OSGi, OSGi will resolve the required dependencies and 
>>>> download them if not already present on the client, OSGi will give 
>>>> preference if a compatible version of the bundle dependencies 
>>>> already loaded at the client.   If using preferred classes the 
>>>> preferred class list will determine the order of preference, 
>>>> whether classes are loaded from the proxy codebase or the client 
>>>> ClassLoader (the parent loader of the proxy ClassLoader) first.
>>> I also tried this route and it is a dead end because
>>>
>>> * it is not possible to statically (ie. as part of the software 
>>> package like OSGi manifest) provide dependency resolution 
>>> constraints to be able to exchange arbitrarily constructed object 
>>> graphs *
>>
>>
>> This is a limitation and compromise I have accepted, JGDMS doesn't 
>> attempt to load arbitrarily constructed object graphs, instead it 
>> ensures that both endpoints of a Service have the same class 
>> resolution view, the same proxy bundle version is used at the Server 
>> and client.
>
> This breaks once there are multiple parties (services) involved 
> because it means _all_ of them have to have their software versions 
> synchronised in advance - which in turn makes the excercise moot: if 
> you have to do that there is no need for mobile code anymore.
> What is really IMHO needed is a practical way of independent evolution 
> of system components.
>
>> At the server, the proxy bundle is depended upon by the service 
>> implementation, but  nothing at the client depends upon the proxy 
>> bundle loaded there, instead the proxy bundle depends on the api 
>> loaded by the client.  That is why JGDMS discourages marshaling of 
>> client subclasses that override service method parameter classes, 
>> because they cannot be exported as remote objects and are subject to 
>> codebase annotation loss and class resolution problems.
>
> There is no subclassing in my example of RemoteEventSpacePublisher.
>
>> Sometimes, less is more, I've chosen this compromise in this instance 
>> to avoid complexity.  I saw little to be gained from the added 
>> complexity, it can be worked around by improving service api design 
>> and practices.
>
> It cannot. How would you improve RemoteEventListener or JavaSpace API 
> to avoid these issues?
>
>>   Instead the client can export method parameter interface types as 
>> remote objects, with independent ClassLoader visibility, that will 
>> resolve to common super interface types.
>>
>> If there is a versioning problem at the client, where it uses an 
>> incompatible API with the client, ServiceDiscoveryManager will 
>> recognise the service is the incorrect type and discard it.
>
> The whole point of my example is that this is not the issue of 
> compatibility between client and service interface but it is inherent 
> to existing class loading mechanism.
>
>>
>> I recognise my own limitations, I'm not smart enough to solve the 
>> problems of de-serialization of arbitrary object graphs,
>> so I have left it as a task for someone either smarter or more 
>> determined than myself and focused on what I believe is an acceptable 
>> and reliable compromise. It is because of my own limitations, that I 
>> reduced complexity, so that I (as well as inexperienced users) didn't 
>> have to worry about codebase annotation loss or class resolution issues.
>>
>> I'm not saying it can't be solved, or that you won't succeed, simply 
>> that after a lot of thought, I decided it would be easier to reduce 
>> complexity and accept some limitations as this seems like the best 
>> compromise, there are also other things which have a higher priority 
>> for my time.
>
> It wasn’t my intent to make this really interesting technical 
> discussion personal but rather try to discuss the limitations of 
> Jini/River and the possible directions.
>
> I personally find the idea of mobile objects really interesting and 
> very influential to the way how systems are implemented.
> Having a single uniform way of exchanging both code and data opens up 
> a lot of possibilities.
>
> Think of loggers being services implemented by mobile objects that can 
> be replaced with new versions easily - log4shell would not be such a 
> huge nightmare to handle.
>
> What’s more - mobile code is something you are doing anyway - but in 
> an ad-hoc ways that are incompatible with each other.
>
> Michal 

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Michał Kłeczek <mi...@kleczek.org>.
Hi Peter,

> On 16 Feb 2022, at 10:01, Peter Firmstone <pe...@zeus.net.au> wrote:
> 
> Inline below.
> 
> On 16/02/2022 5:24 pm, Michał Kłeczek wrote:
>> 
>>> On 16 Feb 2022, at 04:25, Peter Firmstone <pe...@zeus.net.au> wrote:
>>> 
>>> From the CodebaseAccessor service.
>>> 
>>> The CodebaseAccessor proxy (local code) is passed as a parameter along with a MarshalledInstance of the proxy, by ProxySerializer to ProxyCodebaseSpi.
>>> 
>>> https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java <https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java>
>> Ok, so you have introduced a level of indirection to retrieve String codebase annotations. Why not go one step further and instead of:
>> 
>> interface CodebaseAccessor {
>>   String getClassAnnotation() throws IOException;
>> }
>> 
>> have something along the lines of (conceptually):
>> 
>> interface Codebase extends RemoteMethodControl {
>>   ClassLoader getClassLoader() throws IOException;
>> }
> 
> 
> I personally wouldn't take this step, because CodebaseAccessor is a Remote interface and ClassLoader is a class of high privilege, so it presents a security risk. 

Not really as implementation is constrained by the same security rules as any other code: you can constrain it via policy that only grants create ClassLoader permission to specific implementations.

>> See above:
>> you can move this code from the client to the service and let it provide the implementation of class resolution algorithm.
> 
> 
> I would advise against that, the remote service JVM knows little about the client JVM, both are likely to have completely different ClassLoader hierarchies.

To be able to communicate they have to understand each other class loading mechanism anyway.
In particular the class annotation String syntax and semantics has to be the same for both.

[...]
> 
>>> 
>>> If using OSGi, OSGi will resolve the required dependencies and download them if not already present on the client, OSGi will give preference if a compatible version of the bundle dependencies already loaded at the client.   If using preferred classes the preferred class list will determine the order of preference, whether classes are loaded from the proxy codebase or the client ClassLoader (the parent loader of the proxy ClassLoader) first.
>> I also tried this route and it is a dead end because
>> 
>> * it is not possible to statically (ie. as part of the software package like OSGi manifest) provide dependency resolution constraints to be able to exchange arbitrarily constructed object graphs *
> 
> 
> This is a limitation and compromise I have accepted, JGDMS doesn't attempt to load arbitrarily constructed object graphs, instead it ensures that both endpoints of a Service have the same class resolution view, the same proxy bundle version is used at the Server and client.

This breaks once there are multiple parties (services) involved because it means _all_ of them have to have their software versions synchronised in advance - which in turn makes the excercise moot: if you have to do that there is no need for mobile code anymore.
What is really IMHO needed is a practical way of independent evolution of system components.

> At the server, the proxy bundle is depended upon by the service implementation, but  nothing at the client depends upon the proxy bundle loaded there, instead the proxy bundle depends on the api loaded by the client.  That is why JGDMS discourages marshaling of client subclasses that override service method parameter classes, because they cannot be exported as remote objects and are subject to codebase annotation loss and class resolution problems. 

There is no subclassing in my example of RemoteEventSpacePublisher.

> Sometimes, less is more, I've chosen this compromise in this instance to avoid complexity.  I saw little to be gained from the added complexity, it can be worked around by improving service api design and practices.

It cannot. How would you improve RemoteEventListener or JavaSpace API to avoid these issues?

>   Instead the client can export method parameter interface types as remote objects, with independent ClassLoader visibility, that will resolve to common super interface types.
> 
> If there is a versioning problem at the client, where it uses an incompatible API with the client, ServiceDiscoveryManager will recognise the service is the incorrect type and discard it.

The whole point of my example is that this is not the issue of compatibility between client and service interface but it is inherent to existing class loading mechanism.

> 
> I recognise my own limitations, I'm not smart enough to solve the problems of de-serialization of arbitrary object graphs,
> so I have left it as a task for someone either smarter or more determined than myself and focused on what I believe is an acceptable and reliable compromise. It is because of my own limitations, that I reduced complexity, so that I (as well as inexperienced users) didn't have to worry about codebase annotation loss or class resolution issues.
> 
> I'm not saying it can't be solved, or that you won't succeed, simply that after a lot of thought, I decided it would be easier to reduce complexity and accept some limitations as this seems like the best compromise, there are also other things which have a higher priority for my time.

It wasn’t my intent to make this really interesting technical discussion personal but rather try to discuss the limitations of Jini/River and the possible directions.

I personally find the idea of mobile objects really interesting and very influential to the way how systems are implemented.
Having a single uniform way of exchanging both code and data opens up a lot of possibilities.

Think of loggers being services implemented by mobile objects that can be replaced with new versions easily - log4shell would not be such a huge nightmare to handle.

What’s more - mobile code is something you are doing anyway - but in an ad-hoc ways that are incompatible with each other.

Michal

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
Hi Michał,

Inline below.

On 16/02/2022 5:24 pm, Michał Kłeczek wrote:
>
>> On 16 Feb 2022, at 04:25, Peter Firmstone <pe...@zeus.net.au> wrote:
>>
>>  From the CodebaseAccessor service.
>>
>> The CodebaseAccessor proxy (local code) is passed as a parameter along with a MarshalledInstance of the proxy, by ProxySerializer to ProxyCodebaseSpi.
>>
>> https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java <https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java>
> Ok, so you have introduced a level of indirection to retrieve String codebase annotations. Why not go one step further and instead of:
>
> interface CodebaseAccessor {
>    String getClassAnnotation() throws IOException;
> }
>
> have something along the lines of (conceptually):
>
> interface Codebase extends RemoteMethodControl {
>    ClassLoader getClassLoader() throws IOException;
> }


I personally wouldn't take this step, because CodebaseAccessor is a 
Remote interface and ClassLoader is a class of high privilege, so it 
presents a security risk.  It is also used in IPv6 multicast lookup 
discovery, where I want to avoid sending any objects over the network.

If you want to send java bytecode, you could do that by converting the 
byte[] array to a String, then convert it back to byte[], that way you 
can leverage existing api.  The problem is that you are still 
constrained by the limitations I have chosen, that is, to use 
CodebaseAccessor requires the export of a remote object.  I think you 
wish to be able to send arbitrary graphs, so you will need to append 
these bytes in the stream, rather than use CodebaseAccessor.

>
> The reasoning is:
> In principle class annotation is a program in (unspecified) language that is executed by the client to create a ClassLoader instance.
> You have to make sure all participants share this language and can execute it in the same way.
> If the type of class annotation is String - it only means this is some kind of obscure interpreted scripting language.
>
> The insight here is that we _already have_ the language that we _know_ all participants can execute: Java bytecode.
> There is no reason not to use it.
>
>>> Ok, so the client has to know in advance how to load the service code?
>> Yes, the client knows how to load the service code dynamically just prior to proxy unmarshalling, a default ProxyCodebaseSpi is provided for that purpose and it is used by default.
> See above:
> you can move this code from the client to the service and let it provide the implementation of class resolution algorithm.


I would advise against that, the remote service JVM knows little about 
the client JVM, both are likely to have completely different ClassLoader 
hierarchies.

What I try to do is have identical bundles loaded by the ClassLoaders at 
the ServerEndpoint and (client) Endpoint and let OSGi resolve the 
classes, so they both have an absolutely identical view of classes.  At 
the very least, dependency bundles resolved need to be version 
compatible for serialized form.   Same with other modular frameworks.


>
>> If you are using Maven, eg Rio Resolver, or OSGi, then a ProxyCodebaseSpi implementation specific to one of these should be used.  If you have a mixed environment, then you can use the codebase string to determine which to use.
> See above: you can also abstract it away behind an interface.
>
>>>>> Does it require to have it installed in advance? If so - how?
>>>> Only JGDMS platform and JERI.
>>>>
>>>>
>>> How are service proxy classes loaded then?
>> ProxyCodebaseSpi::resolve does this by provisioning a ClassLoader then unmarshalling the proxy into it.
>>
>> OSGi:
>>
>> https://github.com/pfirmstone/JGDMS/blob/a774a9141e6571f1d7f9771f74b714850d447d3e/JGDMS/jgdms-osgi-proxy-bundle-provider/src/main/java/org/apache/river/osgi/ProxyBundleProvider.java#L131 <https://github.com/pfirmstone/JGDMS/blob/a774a9141e6571f1d7f9771f74b714850d447d3e/JGDMS/jgdms-osgi-proxy-bundle-provider/src/main/java/org/apache/river/osgi/ProxyBundleProvider.java#L131>
> [...]
>
>>> I am asking about something different - the smart proxy class depends on _two_ interfaces:
>>>
>>> RemoteEventListener <—— proxy class ——> JavaSpace
>>>
>>> RemoteEventListener is its service interface.
>>> But it is not known in advance what interfaces the client already has:
>>>
>>> 1) Just RemoteEventListener
>>> 2) Both RemoteEventListener and JavaSpace
>>> 3) None
>>>
>>> How is class resolution implemented in JGDMS so that it works properly in _all_ of the above cases?
>> This is a responsibility of the underlying platform used for class resolution or modularity.
>>
>> If using OSGi, OSGi will resolve the required dependencies and download them if not already present on the client, OSGi will give preference if a compatible version of the bundle dependencies already loaded at the client.   If using preferred classes the preferred class list will determine the order of preference, whether classes are loaded from the proxy codebase or the client ClassLoader (the parent loader of the proxy ClassLoader) first.
> I also tried this route and it is a dead end because
>
> * it is not possible to statically (ie. as part of the software package like OSGi manifest) provide dependency resolution constraints to be able to exchange arbitrarily constructed object graphs *


This is a limitation and compromise I have accepted, JGDMS doesn't 
attempt to load arbitrarily constructed object graphs, instead it 
ensures that both endpoints of a Service have the same class resolution 
view, the same proxy bundle version is used at the Server and client.  
At the server, the proxy bundle is depended upon by the service 
implementation, but  nothing at the client depends upon the proxy bundle 
loaded there, instead the proxy bundle depends on the api loaded by the 
client.  That is why JGDMS discourages marshaling of client subclasses 
that override service method parameter classes, because they cannot be 
exported as remote objects and are subject to codebase annotation loss 
and class resolution problems.  Sometimes, less is more, I've chosen 
this compromise in this instance to avoid complexity.  I saw little to 
be gained from the added complexity, it can be worked around by 
improving service api design and practices.  Instead the client can 
export method parameter interface types as remote objects, with 
independent ClassLoader visibility, that will resolve to common super 
interface types.

If there is a versioning problem at the client, where it uses an 
incompatible API with the client, ServiceDiscoveryManager will recognise 
the service is the incorrect type and discard it.

I recognise my own limitations, I'm not smart enough to solve the 
problems of de-serialization of arbitrary object graphs, so I have left 
it as a task for someone either smarter or more determined than myself 
and focused on what I believe is an acceptable and reliable compromise.  
It is because of my own limitations, that I reduced complexity, so that 
I (as well as inexperienced users) didn't have to worry about codebase 
annotation loss or class resolution issues.

I'm not saying it can't be solved, or that you won't succeed, simply 
that after a lot of thought, I decided it would be easier to reduce 
complexity and accept some limitations as this seems like the best 
compromise, there are also other things which have a higher priority for 
my time.

Cheers,

Peter.

>
> Take for example the RemoteEventSpacePublisher class from my previous email:
>
> interface RemoteEventListener {
> }
>
> package net.jini.space;
> interface JavaSpace {
> }
>
> Bundle manifest:
> Import-Package: net.jini.space;version=“[1.0,1.7)”
>
> //implements JavaSpace up to version 1.7
> class JavaSpaceImplProxy implements JavaSpace, Serializable {
> }
>
> Bundle manifest:
> Import-Package: net.jini.space;version=“[1.5,2.0)”
>
> //Requires JavaSpace of at least version 1.5
> class RemoteEventSpacePublisher implements RemoteEventListener, Serializable {
>    private JavaSpace space;
> }
>
>
> During deserialisation of RemoteEventSpacePublisher the resolution of a bundle containing JavaSpace interface has to result in a _single_ bundle that provides net.jini.space package obeying _two_ constraints:
> Import-Package: net.jini.space;version=“[1.5,2.0)” - from RemoteEventSpacePublisher
> Import-Package: net.jini.space;version=“[1.0,1.7)” - from JavaSpaceImplProxy
>
> The problem  is that this information is not known to the client OSGi runtime:
>
> 1. It first resolves RemoteEventSpacePublisher annotation to a bundle wired to some bundle providing net.jini.space;version=“[1.5,2.0)”
> 2. After that it _separately_ resolves JavaSpaceImplProxy annotation to a bundle wired to _possibly different_ bundle providing net.jini.space;version=“[1.0,1.7)”
>
> The reason is that when serialising the object graph in your solution you are loosing information about effective runtime constraints used for class resolution.
> Your ProxyBundleProvider interprets codebase annotation as a path to a specific bundle - but it does not contain any information about this bundle wiring in the service VM.
>
>> If using Rio Resolver, it will downloaded any required dependencies dynamically using Maven.
> I am afraid it does not change anything.
>
>> https://github.com/pfirmstone/JGDMS/wiki/OSGi-and-JGDMS <https://github.com/pfirmstone/JGDMS/wiki/OSGi-and-JGDMS>
>>
>> What I learned from the many discussions and arguments on River mailing lists, was that developers use different platforms to manage class resolution visibility or provide modularity, so I considered it important not to constrain developers and allow them to use their preferred platform, not to decide for them.
> The point is that _none_ of the existing platforms can handle it properly (see above).
>
> Once you solve the problem of exchanging arbitrarily constructed object graphs of dynamically downloaded and resolved classes it opens up a whole lot of possibilities because you can quite easily model solutions as POJOs.
>
> Cheers,
> Michal
>
>

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Michał Kłeczek <mi...@kleczek.org>.

> On 16 Feb 2022, at 04:25, Peter Firmstone <pe...@zeus.net.au> wrote:
> 
> From the CodebaseAccessor service.
> 
> The CodebaseAccessor proxy (local code) is passed as a parameter along with a MarshalledInstance of the proxy, by ProxySerializer to ProxyCodebaseSpi.
> 
> https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java <https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java>

Ok, so you have introduced a level of indirection to retrieve String codebase annotations. Why not go one step further and instead of:

interface CodebaseAccessor {
  String getClassAnnotation() throws IOException;
}

have something along the lines of (conceptually):

interface Codebase extends RemoteMethodControl {
  ClassLoader getClassLoader() throws IOException;
}

The reasoning is:
In principle class annotation is a program in (unspecified) language that is executed by the client to create a ClassLoader instance.
You have to make sure all participants share this language and can execute it in the same way.
If the type of class annotation is String - it only means this is some kind of obscure interpreted scripting language.

The insight here is that we _already have_ the language that we _know_ all participants can execute: Java bytecode.
There is no reason not to use it.

>>> 
>> Ok, so the client has to know in advance how to load the service code?
> 
> Yes, the client knows how to load the service code dynamically just prior to proxy unmarshalling, a default ProxyCodebaseSpi is provided for that purpose and it is used by default.

See above:
you can move this code from the client to the service and let it provide the implementation of class resolution algorithm.

> 
> If you are using Maven, eg Rio Resolver, or OSGi, then a ProxyCodebaseSpi implementation specific to one of these should be used.  If you have a mixed environment, then you can use the codebase string to determine which to use.

See above: you can also abstract it away behind an interface.

> 
>>> 
>>>> Does it require to have it installed in advance? If so - how?
>>> 
>>> Only JGDMS platform and JERI.
>>> 
>>> 
>> How are service proxy classes loaded then?
> 
> ProxyCodebaseSpi::resolve does this by provisioning a ClassLoader then unmarshalling the proxy into it.
> 
> OSGi:
> 
> https://github.com/pfirmstone/JGDMS/blob/a774a9141e6571f1d7f9771f74b714850d447d3e/JGDMS/jgdms-osgi-proxy-bundle-provider/src/main/java/org/apache/river/osgi/ProxyBundleProvider.java#L131 <https://github.com/pfirmstone/JGDMS/blob/a774a9141e6571f1d7f9771f74b714850d447d3e/JGDMS/jgdms-osgi-proxy-bundle-provider/src/main/java/org/apache/river/osgi/ProxyBundleProvider.java#L131>

[...]

> 
>> I am asking about something different - the smart proxy class depends on _two_ interfaces:
>> 
>> RemoteEventListener <—— proxy class ——> JavaSpace
>> 
>> RemoteEventListener is its service interface.
>> But it is not known in advance what interfaces the client already has:
>> 
>> 1) Just RemoteEventListener
>> 2) Both RemoteEventListener and JavaSpace
>> 3) None
>> 
>> How is class resolution implemented in JGDMS so that it works properly in _all_ of the above cases?
> 
> This is a responsibility of the underlying platform used for class resolution or modularity.
> 
> If using OSGi, OSGi will resolve the required dependencies and download them if not already present on the client, OSGi will give preference if a compatible version of the bundle dependencies already loaded at the client.   If using preferred classes the preferred class list will determine the order of preference, whether classes are loaded from the proxy codebase or the client ClassLoader (the parent loader of the proxy ClassLoader) first.

I also tried this route and it is a dead end because

* it is not possible to statically (ie. as part of the software package like OSGi manifest) provide dependency resolution constraints to be able to exchange arbitrarily constructed object graphs *

Take for example the RemoteEventSpacePublisher class from my previous email:

interface RemoteEventListener {
}

package net.jini.space;
interface JavaSpace {
}

Bundle manifest:
Import-Package: net.jini.space;version=“[1.0,1.7)”

//implements JavaSpace up to version 1.7
class JavaSpaceImplProxy implements JavaSpace, Serializable {
}

Bundle manifest:
Import-Package: net.jini.space;version=“[1.5,2.0)”

//Requires JavaSpace of at least version 1.5
class RemoteEventSpacePublisher implements RemoteEventListener, Serializable {
  private JavaSpace space;
}


During deserialisation of RemoteEventSpacePublisher the resolution of a bundle containing JavaSpace interface has to result in a _single_ bundle that provides net.jini.space package obeying _two_ constraints:
Import-Package: net.jini.space;version=“[1.5,2.0)” - from RemoteEventSpacePublisher
Import-Package: net.jini.space;version=“[1.0,1.7)” - from JavaSpaceImplProxy

The problem  is that this information is not known to the client OSGi runtime:

1. It first resolves RemoteEventSpacePublisher annotation to a bundle wired to some bundle providing net.jini.space;version=“[1.5,2.0)”
2. After that it _separately_ resolves JavaSpaceImplProxy annotation to a bundle wired to _possibly different_ bundle providing net.jini.space;version=“[1.0,1.7)”

The reason is that when serialising the object graph in your solution you are loosing information about effective runtime constraints used for class resolution.
Your ProxyBundleProvider interprets codebase annotation as a path to a specific bundle - but it does not contain any information about this bundle wiring in the service VM.

> 
> If using Rio Resolver, it will downloaded any required dependencies dynamically using Maven.

I am afraid it does not change anything.

> 
> https://github.com/pfirmstone/JGDMS/wiki/OSGi-and-JGDMS <https://github.com/pfirmstone/JGDMS/wiki/OSGi-and-JGDMS>
> 
> What I learned from the many discussions and arguments on River mailing lists, was that developers use different platforms to manage class resolution visibility or provide modularity, so I considered it important not to constrain developers and allow them to use their preferred platform, not to decide for them.

The point is that _none_ of the existing platforms can handle it properly (see above).

Once you solve the problem of exchanging arbitrarily constructed object graphs of dynamically downloaded and resolved classes it opens up a whole lot of possibilities because you can quite easily model solutions as POJOs.

Cheers,
Michal


Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
Hi Michał, responses inline below.

On 15/02/2022 10:22 pm, Michał Kłeczek wrote:
>
>
>> On 15 Feb 2022, at 13:05, Peter Firmstone 
>> <pe...@zeus.net.au> wrote:
>>
>>
>>> How the client knows the code needed to deserialise?
>>
>> The service provides this information, typically in a services 
>> configuration,
>>
> How is this configuration provided to the client and when?

In the service configuration file, with AtomicILFactory, you specify a 
class, whose ClassLoader will perform class resolution for the 
ServerEndpoint.  You should also use a configuration entry for your 
service codebase string as well as keystores for certificates.  Then 
implement the CodebaseAccessor service, this is not implemented by the 
smart proxy, just the service at the server, a separate CodebaseAccessor 
proxy is created during service export, this is marshalled prior to the 
unmarshalling of the service proxy, using only local code, to allow 
provisioning of the codebase.

Heres an example in Reggie:

https://github.com/pfirmstone/JGDMS/blob/a774a9141e6571f1d7f9771f74b714850d447d3e/JGDMS/services/reggie/reggie-service/src/main/java/org/apache/river/reggie/RegistrarImpl.java#L659

See below for further info how the the codebase string is obtained from 
the CodebaseAccessor service proxy (local code).


>> by default this is a space separated list of URI, similar to a 
>> codebase annotation, but it doesn't have to be.  JERI manages the 
>> deserialization of code through a default ProxyCodebaseSpi 
>> implementation,
>>
> How does the default ProxyCodebaseSpi implementation know where to 
> download code from if there are no annotations?


 From the CodebaseAccessor service.

The CodebaseAccessor proxy (local code) is passed as a parameter along 
with a MarshalledInstance of the proxy, by ProxySerializer to 
ProxyCodebaseSpi.

https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/net/jini/export/CodebaseAccessor.java

https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/org/apache/river/api/io/ProxySerializer.java

Proxies are serialized separately from the current marshalling stream by 
ProxySerializer.  It identifies proxies in the stream and packages them 
for independant unmarshalling.   It does this because it is unlikely the 
current streams Endpoint ClassLoader will be able to resolve classes, it 
is treated as a separate concern, or independent entity.


>> the client applies constraints, to ensure that input validation is 
>> used as well as any other constraints, such as principals, or 
>> encryption strength. ProxyCodebaseSpi can be customized by the 
>> client, so the client may implement ProxyCodebaseSpi if it wants to 
>> do something different, eg use OSGi or Maven to manage dependency 
>> resolution.
>>
> Ok, so the client has to know in advance how to load the service code?

Yes, the client knows how to load the service code dynamically just 
prior to proxy unmarshalling, a default ProxyCodebaseSpi is provided for 
that purpose and it is used by default.

If you are using Maven, eg Rio Resolver, or OSGi, then a 
ProxyCodebaseSpi implementation specific to one of these should be 
used.  If you have a mixed environment, then you can use the codebase 
string to determine which to use.

>>
>>> Does it require to have it installed in advance? If so - how?
>>
>> Only JGDMS platform and JERI.
>>
>>
> How are service proxy classes loaded then?

ProxyCodebaseSpi::resolve does this by provisioning a ClassLoader then 
unmarshalling the proxy into it.

OSGi:

https://github.com/pfirmstone/JGDMS/blob/a774a9141e6571f1d7f9771f74b714850d447d3e/JGDMS/jgdms-osgi-proxy-bundle-provider/src/main/java/org/apache/river/osgi/ProxyBundleProvider.java#L131

Preferred classes:

https://github.com/pfirmstone/JGDMS/blob/a774a9141e6571f1d7f9771f74b714850d447d3e/JGDMS/jgdms-pref-class-loader/src/main/java/net/jini/loader/pref/PreferredProxyCodebaseProvider.java#L106

Basically there are different options for loading proxy classes, 
depending on the underlying platform used for class resolution, JGDMS is 
agnostic toward this.

Future work includes a Rio Resolver provider.

>
>>> How is the following scenario handled:
>>>
>>> class JavaSpaceEventPublisher implements RemoteEventListener, 
>>> Serializable {
>>> private final JavaSpace space;
>>>
>>> //… publish event in JavaSpace implementation
>>> }
>>>
>>> The smart proxy class has dependencies on RemoteEventListener and on 
>>> JavaSpace. How do you properly resolve classes in this case?
>>
>> Typically the client has the ServiceAPI it needs already installed 
>> locally, however this may not always be the case, depending on how 
>> you want to resolve the proxy classes and how much you want to share 
>> with the client, you can include additional jar files in the 
>> annotation, and use preferred.list or you can use Maven or OSGi to 
>> resolve dependencies and provision the ClassLoader used for proxy 
>> deserialization.
>>
> I am asking about something different - the smart proxy class depends 
> on _two_ interfaces:
>
> RemoteEventListener <—— proxy class ——> JavaSpace
>
> RemoteEventListener is its service interface.
> But it is not known in advance what interfaces the client already has:
>
> 1) Just RemoteEventListener
> 2) Both RemoteEventListener and JavaSpace
> 3) None
>
> How is class resolution implemented in JGDMS so that it works properly 
> in _all_ of the above cases?

This is a responsibility of the underlying platform used for class 
resolution or modularity.

If using OSGi, OSGi will resolve the required dependencies and download 
them if not already present on the client, OSGi will give preference if 
a compatible version of the bundle dependencies already loaded at the 
client.   If using preferred classes the preferred class list will 
determine the order of preference, whether classes are loaded from the 
proxy codebase or the client ClassLoader (the parent loader of the proxy 
ClassLoader) first.

If using Rio Resolver, it will downloaded any required dependencies 
dynamically using Maven.

JGDMS AtomicILFactory relies on ClassLoader's assigned to both Endpoints 
of a service for class resolution.  It is the ClassLoader's 
responsibility to resolve classes.  JGDMS makes no assumptions around 
how the ClassLoader will resolve classes.

JGDMS separates services into independent marshal streams, each with 
their own Endpoint ClassLoader's for class resolution. 
InvocationContraints are inherited from the stream context of the parent 
stream marshalling the ProxySerializer, this prevents proxies from 
escaping invocation constraints.

The CodebaseAccessor service also uses the same InvocationHandler used 
by the service proxy (AtomicInvocationHandler), which has an identity 
defined by the underlying ObjectEndpoint and server constraints.   So 
ClassLoader can be stored in a weak map, where the CodebaseAccessor 
represents the service identity, ensuring the correct ClassLoader is 
always found and that different services, even if using the same 
codebase string do not mix.  That is identity is based on not only the 
codebase, but the authenticated identity of secured connections and the 
object identity of the service.  ClassLoaders also provide isolation and 
they represent the identity of a service proxy and any permissions 
granted to it.

MethodConstraints are now strings in StringMethodConstraints and 
BasicMethodConstraints has been deprecated, to avoid (unnecessary) class 
loading and resolution, prior to unmarshalling of the service proxy.

The way Jini resolves classes in a mashal steam, is to use 
RMIClassLoaderSPI, if services are configured using BasicILFactory, then 
this remains unchanged.    Jini also allowed services with different 
identities to share the same ClassLoader if both services had the same 
codebase annotations, so permissions granted to an authenticated service 
could be obtained by simply deserializing a stream with a codebase 
annotation, to gain privilege escalation for gadget attacks.  At some 
point in time, this needs to be deprecated and removed, but I'm allowing 
time for people to migrate.

With JGDMS when AtomicILFactory is specified in a services 
configuration, proxies are removed from the marshaling stream, 
ProxySerializer acts as a reference placeholder, and all proxies are 
marshaled independently using their own stream Endpoints and ClassLoader 
visibility.

https://github.com/pfirmstone/JGDMS/wiki/OSGi-and-JGDMS

What I learned from the many discussions and arguments on River mailing 
lists, was that developers use different platforms to manage class 
resolution visibility or provide modularity, so I considered it 
important not to constrain developers and allow them to use their 
preferred platform, not to decide for them. ClassLoader is the common 
abstraction for class resolution and loading.

>> …[snip]
>>
>> If you want to use non final classes for your service method 
>> arguments and allow clients to override these classes, then you will 
>> need to enable codebase annotations in AtomicILFactory in your 
>> configuration. The caveat is there is no guarantee, the service will 
>> be able to resolve these classes at the server endpoint, or that 
>> codebase annotation loss won't occur, it will try using existing 
>> mechanisms, such as RMIClassLoaderSPI, which is probably fine for 
>> seasoned Jini vets, but not so user friendly for the newbie, who now 
>> has to debug ClassNotFoundExceptions.
>>
>>
>
>
> That’s why I got rid of RMIClassLoaderSPI completely - this is simply 
> a wrong API and has to be thrown away.
>
>
> Michal

Yes, RMIClassLoaderSPI was designed for RMI, it is too simple for the 
complex interconnecting relationships that occur within a djinn.

Cheers,

Peter.

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Michał Kłeczek <mi...@kleczek.org>.

> On 15 Feb 2022, at 13:05, Peter Firmstone <pe...@zeus.net.au> wrote:
> 
> 
>> How the client knows the code needed to deserialise?
> The service provides this information, typically in a services configuration,
> 
How is this configuration provided to the client and when?
> by default this is a space separated list of URI, similar to a codebase annotation, but it doesn't have to be.  JERI manages the deserialization of code through a default ProxyCodebaseSpi implementation,
> 
How does the default ProxyCodebaseSpi implementation know where to download code from if there are no annotations?
> the client applies constraints, to ensure that input validation is used as well as any other constraints, such as principals, or encryption strength.  ProxyCodebaseSpi can be customized by the client, so the client may implement ProxyCodebaseSpi if it wants to do something different, eg use OSGi or Maven to manage dependency resolution.
> 
Ok, so the client has to know in advance how to load the service code?
> 
>> Does it require to have it installed in advance? If so - how?
> Only JGDMS platform and JERI.
> 
> 
> 
How are service proxy classes loaded then?

>> How is the following scenario handled:
>> 
>> class JavaSpaceEventPublisher implements RemoteEventListener, Serializable {
>>   private final JavaSpace space;
>> 
>> //… publish event in JavaSpace implementation
>> }
>> 
>> The smart proxy class has dependencies on RemoteEventListener and on JavaSpace. How do you properly resolve classes in this case?
> Typically the client has the ServiceAPI it needs already installed locally, however this may not always be the case, depending on how you want to resolve the proxy classes and how much you want to share with the client, you can include additional jar files in the annotation, and use preferred.list or you can use Maven or OSGi to resolve dependencies and provision the ClassLoader used for proxy deserialization. 
> 
I am asking about something different - the smart proxy class depends on _two_ interfaces:

RemoteEventListener <—— proxy class ——> JavaSpace

RemoteEventListener is its service interface.
But it is not known in advance what interfaces the client already has:

1) Just RemoteEventListener
2) Both RemoteEventListener and JavaSpace
3) None

How is class resolution implemented in JGDMS so that it works properly in _all_ of the above cases?
> …[snip]
> 
> If you want to use non final classes for your service method arguments and allow clients to override these classes, then you will need to enable codebase annotations in AtomicILFactory in your configuration.   The caveat is there is no guarantee, the service will be able to resolve these classes at the server endpoint, or that codebase annotation loss won't occur, it will try using existing mechanisms, such as RMIClassLoaderSPI, which is probably fine for seasoned Jini vets, but not so user friendly for the newbie, who now has to debug ClassNotFoundExceptions.
> 
> 


That’s why I got rid of RMIClassLoaderSPI completely - this is simply a wrong API and has to be thrown away.


Michal

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
Thanks Roy, I'll keep that in mind.

On 16/02/2022 3:15 am, Roy T. Fielding wrote:
>> On Feb 15, 2022, at 4:05 AM, Peter Firmstone <pe...@zeus.net.au> wrote:
>>
>> I think the PMC has already decided River's fate, and I tend to agree with their decision, the problem is that historically, it hasn't been possible to innovate inside the Apache River project, innovation has been forced to happen elsewhere and it wasn't just what I was doing, there was an attempt to do some container work in River but that also got shut down.  People had trouble in the past agreeing on Rivers direction and there are no currently active developers.   It is still possible to get a group of people together to create an Apache project, but I don't think the code needs it.   github and other sites like it are better for loose collaboration, where developers can feed off each others ideas and innovations and the best solutions survive.
> The PMC has decided to move Apache River to the Attic, and the
> Board is likely to approve that tomorrow.
>
> This is often what triggers people "in waiting" to do something
> on their own rather than wait on a perceived consensus. That is a
> very good thing. It's hard to encourage contributions outside the box
> of an existing design, since there is no clear path to a release.
> Removing the project will remove that perceived barrier to development.
> (Though anyone could have started up a sandbox within the
> original project and done the same. It's just a matter of will.)
>
> In any case, good luck with your efforts. I strongly encourage you to
> select a good project name that reflects your individual goals, rather
> than continue to use River or Jini (which I think is still trademarked
> by Oracle, but maybe they have abandoned it now).
>
> Likewise, if you start moving towards a larger collaboration and need
> a safe place to do that, the ASF will still be here and able to help
> provide legal oversight for your project without managing it for you.
> That is particularly recommended for anything that crosses Java
> with code execution in a remote environment.
>
> Cheers, and thanks for all the +1s
>
> ....Roy
>

Re: [DISCUSS] Moving Apache River to the Attic

Posted by "Roy T. Fielding" <fi...@gbiv.com>.
> On Feb 15, 2022, at 4:05 AM, Peter Firmstone <pe...@zeus.net.au> wrote:
> 
> I think the PMC has already decided River's fate, and I tend to agree with their decision, the problem is that historically, it hasn't been possible to innovate inside the Apache River project, innovation has been forced to happen elsewhere and it wasn't just what I was doing, there was an attempt to do some container work in River but that also got shut down.  People had trouble in the past agreeing on Rivers direction and there are no currently active developers.   It is still possible to get a group of people together to create an Apache project, but I don't think the code needs it.   github and other sites like it are better for loose collaboration, where developers can feed off each others ideas and innovations and the best solutions survive.

The PMC has decided to move Apache River to the Attic, and the
Board is likely to approve that tomorrow.

This is often what triggers people "in waiting" to do something
on their own rather than wait on a perceived consensus. That is a
very good thing. It's hard to encourage contributions outside the box
of an existing design, since there is no clear path to a release.
Removing the project will remove that perceived barrier to development.
(Though anyone could have started up a sandbox within the
original project and done the same. It's just a matter of will.)

In any case, good luck with your efforts. I strongly encourage you to
select a good project name that reflects your individual goals, rather
than continue to use River or Jini (which I think is still trademarked
by Oracle, but maybe they have abandoned it now).

Likewise, if you start moving towards a larger collaboration and need
a safe place to do that, the ASF will still be here and able to help
provide legal oversight for your project without managing it for you.
That is particularly recommended for anything that crosses Java
with code execution in a remote environment.

Cheers, and thanks for all the +1s

....Roy


Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
On 15/02/2022 8:29 pm, Michał Kłeczek wrote:
> Hi Peter,
>>
>> JGDMS uses a new implementation of a subset of the Java 
>> Serialization’s stream format, with input validation and defenses 
>> against malicious data (all connections are first authenticated when 
>> using secure endpoints).   Codebase annotations are no longer 
>> appended in serialization streams, this feature is deprecated but it 
>> can still be enabled.
>>
> How the client knows the code needed to deserialise?

The service provides this information, typically in a services 
configuration, by default this is a space separated list of URI, similar 
to a codebase annotation, but it doesn't have to be.  JERI manages the 
deserialization of code through a default ProxyCodebaseSpi 
implementation, the client applies constraints, to ensure that input 
validation is used as well as any other constraints, such as principals, 
or encryption strength. ProxyCodebaseSpi can be customized by the 
client, so the client may implement ProxyCodebaseSpi if it wants to do 
something different, eg use OSGi or Maven to manage dependency resolution.


> Does it require to have it installed in advance? If so - how?

Only JGDMS platform and JERI.


> How is the following scenario handled:
>
> class JavaSpaceEventPublisher implements RemoteEventListener, 
> Serializable {
>   private final JavaSpace space;
>
> //… publish event in JavaSpace implementation
> }
>
> The smart proxy class has dependencies on RemoteEventListener and on 
> JavaSpace. How do you properly resolve classes in this case?

Typically the client has the ServiceAPI it needs already installed 
locally, however this may not always be the case, depending on how you 
want to resolve the proxy classes and how much you want to share with 
the client, you can include additional jar files in the annotation, and 
use preferred.list or you can use Maven or OSGi to resolve dependencies 
and provision the ClassLoader used for proxy deserialization.


>
>> This paper documents the problems with this approach: 
>> https://dl.acm.org/doi/pdf/10.5555/1698139
>>
>> JGDMS provisions a ClassLoader at each Endpoint, the ClassLoader is 
>> solely responsible for class resolution, once it has been assigned to 
>> the relevant ObjectEndpoint.  A provider mechanism allows customization.
>>
>> JGDMS doesn't suffer from codebase annotation loss, nor class 
>> resolution issues.   But it did have to give up some functionality; 
>> it cannot resolve classes that do not belong to a service proxy or 
>> its service api and are not resolvable from the Endpoint ClassLoader, 
>> if they are not present on the remote machine.   The solution is to 
>> always use a service, for parameters passed to a service, if they are 
>> not part of the service api, eg the client overrides the type of 
>> parameter arguments for a service.  This means that if the parameter 
>> is not an interface, you cannot create a service that implements it 
>> and pass it as an argument.  That’s why its still possible, but not 
>> recommended to use codebase annotations appended to the serialization 
>> stream.  The solution is to create service api that uses only 
>> interfaces for parameter arguments.   For example a remote events and 
>> listeners use this pattern.  To prevent unexpected breakages, either 
>> use interfaces, or final classes, or both, for service api remote 
>> method parameters.  Then you won’t get into the situation where you 
>> need codebase annotations appended in the stream.
>>
>
> I am not sure I follow but...
>
> What I am trying to achieve is exactly the opposite - place as little 
> constraints as possible on service implementors and make the whole 
> thing “magically work” :)


JGDMS only does this with AtomicILFactory by default, you aren't 
constrained to using that, you can enable codebase annotations in the 
stream, or override BasicILFactory, if you want to do something 
different, or just use BasicILFactory as is, you can avoid applying this 
restriction to service parameter arguments, but then you have to accept 
the compromises that come with that such as codebase annotation loss, 
which can spoil the magic.

For me it is simpler to use interface types for service method arguments 
and provide a final implementation class as part of the Service API, 
this allows the client to either use the default ServiceAPI classes or 
implement the interface with another service.

If you want to use non final classes for your service method arguments 
and allow clients to override these classes, then you will need to 
enable codebase annotations in AtomicILFactory in your configuration.   
The caveat is there is no guarantee, the service will be able to resolve 
these classes at the server endpoint, or that codebase annotation loss 
won't occur, it will try using existing mechanisms, such as 
RMIClassLoaderSPI, which is probably fine for seasoned Jini vets, but 
not so user friendly for the newbie, who now has to debug 
ClassNotFoundExceptions.

It's like Java serialization, magic comes with compromises.


>
>> For example if a service proxy is serialized within a serialization 
>> stream, it will be replaced by a proxy serializer and it will be 
>> assigned its own independent stream, with ClassLoader, independent of 
>> the stream in which it was serialized.  This is based on the 
>> ObjectEndpoint identity, so it will always resolve to the same 
>> ClassLoader.  Note that ProxyCodebaseSpi can be a provider or OSGi 
>> service.
>>
> Does it mean you cannot provide services that don’t have any 
> ObjectEndpoint (ie. local only)?
> This would be IMO unacceptable constraint. For example:
>
> - How do you provide the above mentioned JavaSpaceEventPublisher
> - How would you provide a java.sql.DataSource as a service?


If you don't have an ObjectEndpoint, then there is no one to 
authenticate, you only have bytes to de-serialize, so how do you 
establish trust, ie who did the bytes come from?  However it is possible 
to have a service that has an ObjectEndpoint and only uses it for 
authentication of the proxy serializer and codebase provisioning after 
which the deserialized bytes become objects and don't make remote method 
calls.  I think that would be an acceptable alternative; someone needs 
to vouch for the serialized bytes.


>
>> Now the proxy serializer is itself a service (bootstrap proxy), that 
>> is authenticated when using secure endpoints.  You could quite easily 
>> add an interface to the proxy serializer to return your object 
>> annotation.
>>
>> Note that I use a string, because I also use it in secure multicast 
>> discovery protocols (typically IPv6), which don't include objects, 
>> for authentication and provisioning a ClassLoader for a lookup 
>> service proxy prior to any Object de-serialization.
>>
>> https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml
>>
>> Summing up to simplify JGDMS and solve some very difficult issues, it 
>> had to give up:
>>
>>  1. Support for circular references in serialized object graphs, was
>>     dropped.
>>
> My solution supports any object graph.


What capability do you need circular references for?  For example 
Throwable creates a circular object graph.  These circular relationships 
can be reconstructed during deserialization by code, rather than as part 
of the serialized bytes.   Allowing circular object graphs, sounds like 
a neat feature, however it is not possible to validate circular 
relationships atomically, in which case if validation checks fail, you 
have fully constructed objects than an attacker might manipulate for 
gadget attacks.   Atomic input validation prevents object creation, so 
no gadget attack. This is a low risk if you are using authentication, 
but it is still nice to harden the api, in the event that the identity 
of someone you trust has been stolen.


>> 1.
>>
>>
>>
>>  2. Extensible classes in service api method parameters are not advised.
>>
> Yes - this one is tricky although my solution supports that as well 
> (there are edge cases though).
>>
>> 2.
>>
>>
>>  3. ProxyTrust - deprecated and replaced with secure authentication
>>     and httpmd (SHA-256) or signer certificates using ProxySerializer.
>>
> Deprecated in my solution as well: code is validated _before_ execution.

Good decision, it wasn't a good solution and causes unnecessary 
complexity for zero benefit.


>>  4. Untrusted machines are not allowed in a djinn, some level of
>>     trust is required, with authentication and authorisation constraints.
>>
> Not necessary in my solution.
>
>
>
> In general I think the differences are caused by the different 
> perspective:
>
> I see software distribution (ie. mobile code) as orthogonal to networking.
> You see River primarily as networking solution with mobile code 
> dependent on it.
>
> It would be great to be able to merge the ideas and work on common 
> solution.
> The question is whether it should be Apache River project…


I think the PMC has already decided River's fate, and I tend to agree 
with their decision, the problem is that historically, it hasn't been 
possible to innovate inside the Apache River project, innovation has 
been forced to happen elsewhere and it wasn't just what I was doing, 
there was an attempt to do some container work in River but that also 
got shut down.  People had trouble in the past agreeing on Rivers 
direction and there are no currently active developers.   It is still 
possible to get a group of people together to create an Apache project, 
but I don't think the code needs it.   github and other sites like it 
are better for loose collaboration, where developers can feed off each 
others ideas and innovations and the best solutions survive.


>
> BTW the name of the software I am working on is CodeSpaces (and yes I 
> am aware of MS/GitHub product named the same but I came up with it 
> earlier and even registered a domain net.codespaces for this purpose).
>
> Michal


I'll keep an eye out for your work.  I think you'll be able to add this 
functionality extensible to JGDMS as a downstream project, dependent on 
a few JGDMS modules, that way you can focus on what you need to achieve 
without worrying about managing the whole repository.  There may be non 
JGDMS forks of River out there too, but I don't think they will support 
IPv6 discovery and other features that will be of benefit, such as 
support for modern stateless TLS v1.3 session tickets.

Cheers,

Peter.

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Michał Kłeczek <mi...@kleczek.org>.
Hi Peter,
> JGDMS uses a new implementation of a subset of the Java Serialization’s stream format, with input validation and defenses against malicious data (all connections are first authenticated when using secure endpoints).   Codebase annotations are no longer appended in serialization streams, this feature is deprecated but it can still be enabled. 
> 
How the client knows the code needed to deserialise?
Does it require to have it installed in advance? If so - how?
How is the following scenario handled:

class JavaSpaceEventPublisher implements RemoteEventListener, Serializable {
  private final JavaSpace space;

//… publish event in JavaSpace implementation
}

The smart proxy class has dependencies on RemoteEventListener and on JavaSpace. How do you properly resolve classes in this case?

> This paper documents the problems with this approach: https://dl.acm.org/doi/pdf/10.5555/1698139 <https://dl.acm.org/doi/pdf/10.5555/1698139>
> JGDMS provisions a ClassLoader at each Endpoint, the ClassLoader is solely responsible for class resolution, once it has been assigned to the relevant ObjectEndpoint.  A provider mechanism allows customization.
> 
> JGDMS doesn't suffer from codebase annotation loss, nor class resolution issues.   But it did have to give up some functionality; it cannot resolve classes that do not belong to a service proxy or its service api and are not resolvable from the Endpoint ClassLoader, if they are not present on the remote machine.   The solution is to always use a service, for parameters passed to a service, if they are not part of the service api, eg the client overrides the type of parameter arguments for a service.  This means that if the parameter is not an interface, you cannot create a service that implements it and pass it as an argument.  That’s why its still possible, but not recommended to use codebase annotations appended to the serialization stream.  The solution is to create service api that uses only interfaces for parameter arguments.   For example a remote events and listeners use this pattern.  To prevent unexpected breakages, either use interfaces, or final classes, or both, for service api remote method parameters.  Then you won’t get into the situation where you need codebase annotations appended in the stream.
> 

I am not sure I follow but...

What I am trying to achieve is exactly the opposite - place as little constraints as possible on service implementors and make the whole thing “magically work” :)

> For example if a service proxy is serialized within a serialization stream, it will be replaced by a proxy serializer and it will be assigned its own independent stream, with ClassLoader, independent of the stream in which it was serialized.  This is based on the ObjectEndpoint identity, so it will always resolve to the same ClassLoader.  Note that ProxyCodebaseSpi can be a provider or OSGi service.
> 
Does it mean you cannot provide services that don’t have any ObjectEndpoint (ie. local only)?
This would be IMO unacceptable constraint. For example:

- How do you provide the above mentioned JavaSpaceEventPublisher
- How would you provide a java.sql.DataSource as a service?

> Now the proxy serializer is itself a service (bootstrap proxy), that is authenticated when using secure endpoints.  You could quite easily add an interface to the proxy serializer to return your object annotation.
> 
> Note that I use a string, because I also use it in secure multicast discovery protocols (typically IPv6), which don't include objects, for authentication and provisioning a ClassLoader for a lookup service proxy prior to any Object de-serialization.
> 
> https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml <https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml>
> Summing up to simplify JGDMS and solve some very difficult issues, it had to give up:
> 
> Support for circular references in serialized object graphs, was dropped.
My solution supports any object graph.
> 
> Extensible classes in service api method parameters are not advised.
Yes - this one is tricky although my solution supports that as well (there are edge cases though).
> 
> ProxyTrust - deprecated and replaced with secure authentication and httpmd (SHA-256) or signer certificates using ProxySerializer.
Deprecated in my solution as well: code is validated _before_ execution.
> Untrusted machines are not allowed in a djinn, some level of trust is required, with authentication and authorisation constraints.
Not necessary in my solution.



In general I think the differences are caused by the different perspective:

I see software distribution (ie. mobile code) as orthogonal to networking.
You see River primarily as networking solution with mobile code dependent on it.

It would be great to be able to merge the ideas and work on common solution.
The question is whether it should be Apache River project…

BTW the name of the software I am working on is CodeSpaces (and yes I am aware of MS/GitHub product named the same but I came up with it earlier and even registered a domain net.codespaces for this purpose).

Michal

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Peter Firmstone <pe...@zeus.net.au>.
Hi Michał, thank you for your compliment, I can assure you, I have had a 
lot of help and guidance from others ;-).

You are right, people have different visions and needs, on github you 
can fork and collaborate, or fork and do your own thing.  The vision and 
the implementation are two different things, often the implementation is 
designed or conceived then changes and evolves in response to overcoming 
challenges, as it is a process of discovery, of learning.   Because 
River had an existing user base, the experimentation required to solve 
difficult problems was significantly constrained due to fears of 
breaking backward compatibility, differing visions, or opinions of what 
River should be.

What is possible, that is not generally done, or possibly even thought 
of, because it is considered too difficult:

Peer to peer connectivity using services secured over untrusted networks 
(the internet), with authentication and access controls, to establish 
trust among separate parties cooperating dynamically to exchange 
information and logic.  Basically a distributed dynamic operating system 
using Java.   You could argue that Javascript is logic, but it is one 
way, publish subscribe, the client has to remain connected for the 
server to push notifications, there is always a one to many relationship 
between the server and clients.  In our case the client is likely also a 
server, it can be much more dynamic, more easily constructed, reliable 
and up-gradable.

> JINI ORIGINS
> Pre-1994, Bill Joy presented a proposal to Sun Labs where he
> presented three main concepts:
> 1) a language that would run on all platforms,
> 2) a virtual machine to run this language, and
> 3) a networked system to allow the distributed virtual machines
> to work as a singular system.
> In 1995, the language and virtual machine were introduced to
> the market as the Java Programming language and Java Virtual
> Machine. The system context, however, was kept in the Sun R&D
> for continued research and development. This system context
> is Jini.

Jini 2.x, although originally intended for untrusted networks, was 
trapped by NAT and IPv4 in local networks, limiting its appeal.  NAT 
destroyed end to end connectivity, changing the internet into a publish 
subscribe model, which didn't fit well with Jini’s peer to peer 
architecture.   Some have incorrectly claimed that Jini isn't peer to 
peer, because of the lookup service, but failed to recognise that it was 
possible to have multiple lookup services and different groups.

There are sufficient IPv6 network providers now for peer to peer networking.

JGDMS is a modular Maven based fork of River (prior to the release of 
River 3.0, code that was originally intended for River), feel free to 
fork it as a base for JPMS modules.   I think the OSGi designers have 
some valid criticisms of JPMS, as well as advise for working around some 
of its pitfalls. 
https://www.infoq.com/articles/java9-osgi-future-modularity/ JGDMS 
modules are also OSGi bundles and service providers are also registered 
and consumed as OSGi services, when OSGi is present.

The qa test suite in JGDMS now runs tests with JSSE enabled, if you do 
this in River, many tests fail, as Sun’s Jini2.1 didn't completely 
support secure services.

The point of Jini 2.1 was to run on untrusted networks (the internet), I 
remember listening to one of Jim Waldo’s talks on work that was still 
required / outstanding in JCM10, unfortunately the video is no longer 
available.   Perhaps someone archived it? A summary can be found here: 
https://wstrange.wordpress.com/2006/10/05/summary-jim-waldos-keynote-at-the-10th-jini-community-meeting/

JGDMS uses a new implementation of a subset of the Java Serialization’s 
stream format, with input validation and defenses against malicious data 
(all connections are first authenticated when using secure endpoints).   
Codebase annotations are no longer appended in serialization streams, 
this feature is deprecated but it can still be enabled.  This paper 
documents the problems with this approach: 
https://dl.acm.org/doi/pdf/10.5555/1698139

JGDMS provisions a ClassLoader at each Endpoint, the ClassLoader is 
solely responsible for class resolution, once it has been assigned to 
the relevant ObjectEndpoint.  A provider mechanism allows customization.

JGDMS doesn't suffer from codebase annotation loss, nor class resolution 
issues.   But it did have to give up some functionality; it cannot 
resolve classes that do not belong to a service proxy or its service api 
and are not resolvable from the Endpoint ClassLoader, if they are not 
present on the remote machine.   The solution is to always use a 
service, for parameters passed to a service, if they are not part of the 
service api, eg the client overrides the type of parameter arguments for 
a service.  This means that if the parameter is not an interface, you 
cannot create a service that implements it and pass it as an argument.  
That’s why its still possible, but not recommended to use codebase 
annotations appended to the serialization stream. The solution is to 
create service api that uses only interfaces for parameter arguments.   
For example a remote events and listeners use this pattern.  To prevent 
unexpected breakages, either use interfaces, or final classes, or both, 
for service api remote method parameters.  Then you won’t get into the 
situation where you need codebase annotations appended in the stream.

For example if a service proxy is serialized within a serialization 
stream, it will be replaced by a proxy serializer and it will be 
assigned its own independent stream, with ClassLoader, independent of 
the stream in which it was serialized.  This is based on the 
ObjectEndpoint identity, so it will always resolve to the same 
ClassLoader.  Note that ProxyCodebaseSpi can be a provider or OSGi service.

Now the proxy serializer is itself a service (bootstrap proxy), that is 
authenticated when using secure endpoints.  You could quite easily add 
an interface to the proxy serializer to return your object annotation.

Note that I use a string, because I also use it in secure multicast 
discovery protocols (typically IPv6), which don't include objects, for 
authentication and provisioning a ClassLoader for a lookup service proxy 
prior to any Object de-serialization.

https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml

Summing up to simplify JGDMS and solve some very difficult issues, it 
had to give up:

 1. Support for circular references in serialized object graphs, was
    dropped.
 2. Extensible classes in service api method parameters are not advised.
 3. ProxyTrust - deprecated and replaced with secure authentication and
    httpmd (SHA-256) or signer certificates using ProxySerializer.
 4. Untrusted machines are not allowed in a djinn, some level of trust
    is required, with authentication and authorisation constraints.

What enabled solving these issues, was the River community’s (and Jini 
users) ability to identify problems, although they didnt agree on 
solutions, they identified the problems and that’s the most important 
step in finding a solution.

I’d like to say that all of the problems with Jini 2.1 on the internet 
were solved, but there is always something left to do, such as 
supporting a marshaling layer within JERI to allow extensible support 
for different serialization protocols, or re-implementing access 
controls following JEP 411.

BasicILFactory is still available, should you wish to adopt a more 
conventional approach, using Java Serialization.

Regards,

Peter.

/*
  * Copyright 2018 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
package org.apache.river.api.io;

import net.jini.loader.ProxyCodebaseSpi;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInput;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.security.AccessController;
import java.security.Guard;
import java.security.PrivilegedAction;
import java.util.Collection;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.jini.core.constraint.RemoteMethodControl;
import net.jini.export.ProxyAccessor;
import net.jini.export.CodebaseAccessor;
import net.jini.export.DynamicProxyCodebaseAccessor;
import net.jini.io.MarshalInputStream;
import net.jini.io.MarshalledInstance;
import org.apache.river.api.io.AtomicSerial.GetArg;
import org.apache.river.api.io.AtomicSerial.PutArg;
import org.apache.river.api.io.AtomicSerial.ReadObject;
import org.apache.river.api.io.AtomicSerial.SerialForm;
import org.apache.river.resource.Service;

/**
  *
  * @author peter
  */
@AtomicSerial
class ProxySerializer implements Serializable {
     private static final long serialVersionUID = 1L;

     private static final String BOOTSTRAP_PROXY = "bootstrapProxy";
     private static final String SERVICE_PROXY = "serviceProxy";

     /**
      * By defining serial persistent fields, we don't need to use 
transient fields.
      * All fields can be final and this object becomes immutable.
      */
     private static final ObjectStreamField[] serialPersistentFields =
     serialForm();

     public static SerialForm[] serialForm(){
         return new SerialForm[]{
             new SerialForm(BOOTSTRAP_PROXY, CodebaseAccessor.class),
         new SerialForm(SERVICE_PROXY, MarshalledInstance.class)
         };
     }

     public static void serialize(PutArg arg, ProxySerializer ps) throws 
IOException{
         arg.put(BOOTSTRAP_PROXY, ps.bootstrapProxy);
         arg.put(SERVICE_PROXY, ps.serviceProxy);
         arg.writeArgs();
     }
     /**
      * The bootstrap proxy must be limited to the following interfaces, 
in case
      * additional interfaces implemented by the proxy aren't available 
remotely.
      */
     private static final Class[] BOOTSTRAP_PROXY_INTERFACES =
     {
         CodebaseAccessor.class,
         RemoteMethodControl.class
     };

     private static final Logger LOGGER = 
Logger.getLogger("org.apache.river.api.io");


     private static final Guard CLASSLOADER_GUARD = new 
RuntimePermission("getClassLoader");
     /**
      * Returns the class loader for the specified proxy class.
      */
     private static ClassLoader getProxyLoader(final Class proxyClass) {
     return (ClassLoader)
         AccessController.doPrivileged(new PrivilegedAction() {
         public Object run() {
             return proxyClass.getClassLoader();
         }
         });
     }

     private static ProxyCodebaseSpi getProvider(final ClassLoader loader){
     ProxyCodebaseSpi result =
         AccessController.doPrivileged(new 
PrivilegedAction<ProxyCodebaseSpi>(){
         public ProxyCodebaseSpi run(){
             Iterator<ProxyCodebaseSpi> spit =
                 Service.providers(
                 ProxyCodebaseSpi.class,
                 loader
                 );
             CLASSLOADER_GUARD.checkGuard(null);
             while (spit.hasNext()){
             return spit.next();
             }
             return null;
         }
         }
     );
     if (result != null) return result;
     // By default, if no provider is available, doesn't attempt to
     // download codebase or substitute.
     return new ProxyCodebaseSpi(){

         public Object resolve(
             CodebaseAccessor bootstrapProxy,
             MarshalledInstance smartProxy,
             ClassLoader parentLoader,
             ClassLoader verifierLoader,
             Collection context) throws IOException, ClassNotFoundException
         {
         return smartProxy.get(parentLoader, true, verifierLoader, context);
         }

         public boolean substitute(
             Class serviceClass,
             ClassLoader streamLoader)
         {
         return false;
         }

     };
     }

     public static Object create(DynamicProxyCodebaseAccessor proxy, 
ClassLoader streamLoader, Collection context) throws IOException {
     Class proxyClass = proxy.getClass();
     if (proxy instanceof RemoteMethodControl //JERI
         && Proxy.isProxyClass(proxyClass)
         && getProvider(streamLoader).substitute(proxyClass, streamLoader)
         )
     {
         // REMIND: InvocationHandler must be available locally, for now
         // it must be an instance of BasicInvocationHandler.
         InvocationHandler h = Proxy.getInvocationHandler(proxy);
         return new ProxySerializer(
         (CodebaseAccessor) 
Proxy.newProxyInstance(getProxyLoader(proxyClass),
             BOOTSTRAP_PROXY_INTERFACES,
             h
         ),
         proxy,
         context
         );

     }
     return proxy;
     }

     public static Object create(ProxyAccessor svc, ClassLoader 
streamLoader, Collection context) throws IOException{
     Object proxy = svc.getProxy();
     Class proxyClass = proxy != null ? proxy.getClass() : null;
     if (proxyClass == null ) LOGGER.log(Level.FINE, "Warning Proxy was 
null for {0}", svc.getClass());
     if (proxy instanceof RemoteMethodControl //JERI
         && proxy instanceof CodebaseAccessor
         && getProvider(streamLoader).substitute(proxyClass, streamLoader)
         )
     {
         // REMIND: InvocationHandler must be available locally, for now
         // it must be an instance of BasicInvocationHandler.
         InvocationHandler h = Proxy.getInvocationHandler(proxy); // 
throws IllegalArgumentException if not a proxy.
         return new ProxySerializer(
         (CodebaseAccessor) 
Proxy.newProxyInstance(getProxyLoader(proxyClass),
             BOOTSTRAP_PROXY_INTERFACES,
             h
         ),
         svc,
         context
         );

     }
     return svc;
     }

     private final CodebaseAccessor bootstrapProxy;
     private final MarshalledInstance serviceProxy;
     private final /*transient*/ Collection context;
     private final /*transient*/ RO read;

     ProxySerializer(CodebaseAccessor p, DynamicProxyCodebaseAccessor a, 
Collection context) throws IOException{
     this(p, new AtomicMarshalledInstance(a, context, false), null, null);

     }

     ProxySerializer(CodebaseAccessor p, ProxyAccessor a, Collection 
context) throws IOException{
     this(p, new AtomicMarshalledInstance(a, context, false), null, null);

     }

     ProxySerializer(CodebaseAccessor p, MarshalledInstance m, 
Collection context, RO read){
     bootstrapProxy = p;
     serviceProxy = m;
     this.context = context;
     this.read = read;
     }

     private static CodebaseAccessor check(CodebaseAccessor c) throws 
InvalidObjectException{
     if (Proxy.isProxyClass(c.getClass())) return c;
     throw new InvalidObjectException(
         "bootstrap proxy must be a dynamically generated instance of 
java.lang.reflect.Proxy");
     }

     ProxySerializer(GetArg arg) throws IOException, ClassNotFoundException{
     this(check(Valid.notNull(
         arg.get(BOOTSTRAP_PROXY, null, CodebaseAccessor.class),
         "bootstrapProxy cannot be null")),
         Valid.notNull(
             arg.get(SERVICE_PROXY, null, MarshalledInstance.class),
             "serviceProxy cannot be null"),
         arg.getObjectStreamContext(),
         (RO) arg.getReader()
     );
     }

     Object readResolve() throws IOException, ClassNotFoundException {
     return getProvider(read.defaultLoader).resolve(bootstrapProxy, 
serviceProxy, read.defaultLoader,
         read.verifierLoader, context);
     }

     // So we can implement ReadObject
     private void writeObject(ObjectOutputStream out) throws IOException {
     out.defaultWriteObject();
     }

     @AtomicSerial.ReadInput
     static ReadObject getReader(){
     return new RO();
     }

     private static class RO implements ReadObject {

     private ClassLoader defaultLoader = null;
     private ClassLoader verifierLoader = null;

     public void read(final ObjectInput input) throws IOException, 
ClassNotFoundException {
         if (input instanceof MarshalInputStream){
         defaultLoader = AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>(){
             public ClassLoader run() {
             return ((MarshalInputStream) input).getDefaultClassLoader();
             }
         });
         verifierLoader = AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>(){
             public ClassLoader run() {
             return ((MarshalInputStream) input).getVerifierClassLoader();
             }
         });
         }
     }

     }
}


/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
  * regarding copyright ownership. The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License. You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */

package net.jini.export;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.rmi.Remote;
import java.security.cert.CertPath;
import java.security.cert.CertificateFactory;
import org.apache.river.api.security.PermissionGrant;
import org.apache.river.api.security.RevocablePolicy;

/**
  * After authenticating a bootstrap token proxy, the ProxyPreparer can
  * dynamically grant DownloadPermission and DeSerializationPermission
  * as required using the information provided, to allow downloading
  * of a smart proxy.
  *
  * To make a ProtectionDomain or CodeSource based grant requires a
  * {@link RevocablePolicy#grant(PermissionGrant) }
  *
  * A service needn't implement this if a proxy doesn't require a codebase
  * download.
  *
  * Certificates et al are sent in encoded format.  The choice was made not
  * to Serialize Certificate or CodeSigner in case the CertificateFactory
  * provider isn't installed and to also allow low level {@link 
java.io.DataInput} and
  * {@link java.io.DataOutput} based communication.
  *
  * @see RevocablePolicy
  * @see PermissionGrant
  */
public interface CodebaseAccessor extends Remote {

     /**
      * Obtains the service class annotation as defined in
      * <code> ClassLoading.getClassAnnotation(Class)</code>.
      *
      * @return the codebase annotation.
      * @throws IOException if a connection problem occurs.
      */
     public String getClassAnnotation() throws IOException;

     /**
      * Get the CertificateFactory type.
      *
      * @return CertificateFactory type or null.
      * @throws IOException if a connection problem occurs.
      * @see CertificateFactory#getInstance(java.lang.String)
      */
     public String getCertFactoryType() throws IOException;

     /**
      * Get the CertPath encoding;
      * @return CertPath encoding or null.
      * @throws IOException if a connection problem occurs.
      * @see CertPath#CertPath(java.lang.String)
      */
     public String getCertPathEncoding() throws IOException;

     /**
      * The byte array can be passed to a ByteArrayInputStream, which can be
      * passed to a CertificateFactory to generate a Collection of 
Certificates,
      * or CertPath.
      *
      * @return a byte array containing certificates or null.
      * @throws IOException if a connection problem occurs.
      * @see ByteArrayInputStream
      * @see CertificateFactory#generateCertPath(java.io.InputStream)
      * @see CertificateFactory#generateCertificates(java.io.InputStream)
      */
     public byte [] getEncodedCerts() throws IOException;

}


On 15/02/2022 1:07 am, Michał Kłeczek wrote:
> Hi All,
>
> Based on the excelent work of (mainly) Peter Firmstone (et al) I am personally working on “River 4.0” right now and was planning to share my work with the community soon(tm).
>
> 1. Implementation of my old idea of making codebase annotations objects implementing a specific interface (instead of Strings containing space delimited list of URLs). One might think of it as “smart codebase annotations” being installers of software necessary to deserialise an object.
>
> 2. Refactoring of River codebase to make it modular (in terms of JPMS modules).
>
> 3. Some cleanup to modernise the codebase (ie. use generics instead of raw types, enums, records where possible/useful)
>
> What it gives us is:
> a) uniform representation of code and data: there is no need to have separate specifications for code metadata languages (manifests etc.). Examples:
> - module dependency graph is represented as serialised Java objects
> - Expressions specifying module compatibility (such as semantic version ranges) are provided as objects implementing a specific interface
> - in particular it is possible not to rely on version numbers but have “animal sniffers” that decide if local code is compatible with downloaded classes
> - installation packages can be provided as serialised objects (either with code serialised in-band or out-of-band depending on the needs)
>
> In other words: “everything is an object”.
>
> b) security
> To instantiate any class and deserialise an object - installer first makes sure code is verified before execution (the verification algorithm is pluggable as the installer can be any object implementing an interface).
> Installers are treated the same way - the code of the installer has to be verified first.
> The installer itself grants permissions to the code it installs and is constrained by any GrantPermissions it has.
>
> So no more unverified code execution - contrary to old Jini way of instantiating an unknown class to ask for a verifier.
>
> c) great flexibility of the way how code is downloaded and installed:
> - in particular it is possible to express a module dependency graph that can be instantiated in the client VM
> - since codebase annotations are objects that are also annotated - it is now possible to provide new protocols to download and verify software.
>
> d) since we can now express non-hierarchical module dependencies it is possible to implement scenarios not possible (or really cumbersome) to implement previously:
> - “adapter/wrapper services” - ie. smart proxies that wrap other services proxies. For example RemoteEventListener that pushes events to a JavaSpace.
>
>
>
> I am only doing it for fun and sentiment to Jini idea of mobile code.
>  From reading the mailing list and taking part in some discussions here I can see there is almost no interest in moving River forward.
> And even if there is - there is no clear idea on what direction it should be.
>
> My own opinion on the matter is that the single DEFINING idea of Jini/River is mobile code. Without mobile code there is no reason for Jini to exist:
> - it is 2022 - there are so many excellent networking libraries on the market that River does not bring anything to the table
> - web protocols and new developments such as QUIC make River as a networking solution (even if excellent) less and less relevant.
> - River codebase is outdated and does not play well with the broad Java ecosystem (DI frameworks, pluggable logging, JFR etc.)
> - looks like “static linking” is the current buzz in the industry (either as executables or container images).
>
> On the other hand - having worked quite extensively with k8s/Helm/containers/Docker/microservices and what not - I still think there is still a (big) case for Jini style mobile code. But only if it is re-designed to be secure, robust and flexible.
> There is also Project Loom - it will make River scalable and - hopefully - relevant again.
>
>
> Michal
>
>
>> On 8 Feb 2022, at 01:41, Roy T. Fielding<fi...@gbiv.com>  wrote:
>>
>> Hello everyone,
>>
>> It's that time of year when I try to figure out what I am doing and
>> what I am not, and try to cut back on the stuff that seems unlikely
>> to succeed. I suspect the same is true of others.
>>
>> I had hoped that more new people at River would result in more activity,
>> but that hasn't occurred over the past 9 months and doesn't seem likely
>> in the future. Aside from ASF echoes and Infra-driven website replacement,
>> there has been nothing to report about River the entire time that I have
>> been the chair pro tem, and there hasn't been any chatter by users either.
>>
>> Please feel free to let me know if I am missing something.
>>
>> If not, I'd like us to accept the reality of this situation and move the
>> River project to the Attic. The code will still be available there, and
>> folks are welcome to copy it under the license, move it to Github, or
>> otherwise seek to re-mold it into a collaborative project wherever is
>> most convenient for them.
>>
>> Cheers,
>>
>> ....Roy
>>

Re: [DISCUSS] Moving Apache River to the Attic

Posted by Michał Kłeczek <mi...@kleczek.org>.
Hi All,

Based on the excelent work of (mainly) Peter Firmstone (et al) I am personally working on “River 4.0” right now and was planning to share my work with the community soon(tm).

1. Implementation of my old idea of making codebase annotations objects implementing a specific interface (instead of Strings containing space delimited list of URLs). One might think of it as “smart codebase annotations” being installers of software necessary to deserialise an object.

2. Refactoring of River codebase to make it modular (in terms of JPMS modules).

3. Some cleanup to modernise the codebase (ie. use generics instead of raw types, enums, records where possible/useful)

What it gives us is:
a) uniform representation of code and data: there is no need to have separate specifications for code metadata languages (manifests etc.). Examples:
- module dependency graph is represented as serialised Java objects
- Expressions specifying module compatibility (such as semantic version ranges) are provided as objects implementing a specific interface
- in particular it is possible not to rely on version numbers but have “animal sniffers” that decide if local code is compatible with downloaded classes
- installation packages can be provided as serialised objects (either with code serialised in-band or out-of-band depending on the needs)

In other words: “everything is an object”.

b) security
To instantiate any class and deserialise an object - installer first makes sure code is verified before execution (the verification algorithm is pluggable as the installer can be any object implementing an interface).
Installers are treated the same way - the code of the installer has to be verified first.
The installer itself grants permissions to the code it installs and is constrained by any GrantPermissions it has.

So no more unverified code execution - contrary to old Jini way of instantiating an unknown class to ask for a verifier.

c) great flexibility of the way how code is downloaded and installed:
- in particular it is possible to express a module dependency graph that can be instantiated in the client VM
- since codebase annotations are objects that are also annotated - it is now possible to provide new protocols to download and verify software.

d) since we can now express non-hierarchical module dependencies it is possible to implement scenarios not possible (or really cumbersome) to implement previously:
- “adapter/wrapper services” - ie. smart proxies that wrap other services proxies. For example RemoteEventListener that pushes events to a JavaSpace.



I am only doing it for fun and sentiment to Jini idea of mobile code.
From reading the mailing list and taking part in some discussions here I can see there is almost no interest in moving River forward.
And even if there is - there is no clear idea on what direction it should be.

My own opinion on the matter is that the single DEFINING idea of Jini/River is mobile code. Without mobile code there is no reason for Jini to exist:
- it is 2022 - there are so many excellent networking libraries on the market that River does not bring anything to the table
- web protocols and new developments such as QUIC make River as a networking solution (even if excellent) less and less relevant.
- River codebase is outdated and does not play well with the broad Java ecosystem (DI frameworks, pluggable logging, JFR etc.)
- looks like “static linking” is the current buzz in the industry (either as executables or container images).

On the other hand - having worked quite extensively with k8s/Helm/containers/Docker/microservices and what not - I still think there is still a (big) case for Jini style mobile code. But only if it is re-designed to be secure, robust and flexible.
There is also Project Loom - it will make River scalable and - hopefully - relevant again.


Michal


> On 8 Feb 2022, at 01:41, Roy T. Fielding <fi...@gbiv.com> wrote:
> 
> Hello everyone,
> 
> It's that time of year when I try to figure out what I am doing and
> what I am not, and try to cut back on the stuff that seems unlikely
> to succeed. I suspect the same is true of others.
> 
> I had hoped that more new people at River would result in more activity,
> but that hasn't occurred over the past 9 months and doesn't seem likely
> in the future. Aside from ASF echoes and Infra-driven website replacement,
> there has been nothing to report about River the entire time that I have
> been the chair pro tem, and there hasn't been any chatter by users either.
> 
> Please feel free to let me know if I am missing something.
> 
> If not, I'd like us to accept the reality of this situation and move the
> River project to the Attic. The code will still be available there, and
> folks are welcome to copy it under the license, move it to Github, or
> otherwise seek to re-mold it into a collaborative project wherever is
> most convenient for them.
> 
> Cheers,
> 
> ....Roy
>