Re: [OT] Tomcat Clustering Support

2018-08-28 Thread Jeff Crump
Never mind. It's visible again.

On Tue, Aug 28, 2018, 2:35 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Scott,
>
> I'm no Tomcat-clustering expert, but...
>
> On 8/28/18 13:59, Scott Evans wrote:
> >  > channelSendOptions="10" channelStartOptions="3">
> >
> >  > expireSessionsOnShutdown="false"
> > notifyListenersOnReplication="true" mapSendOptions="10" />
> >
> >  > className="org.apache.catalina.tribes.group.GroupChannel">
> >  > className="org.apache.catalina.tribes.membership.McastService"
> > address="228.1.0.13" port="45522" frequency="500" dropTime="15000"
> > soTimeout="1" domain="mercer"/>  > className="org.apache.catalina.tribes.transport.nio.NioReceiver"
> > address="10.255.250.34" port="4003" selectorTimeout="8000"
> > maxThreads="25" />
> >
> >  > className="org.apache.catalina.tribes.transport.ReplicationTransmitter
> ">
> >
> >
>  > className="org.apache.catalina.tribes.transport.nio.PooledParallelSend
> er"
> >
> >
> timeout="8000" poolSize="25"
> > />   > className="org.apache.catalina.tribes.group.interceptors.TcpPingInterc
> eptor"/>
> >
> >
>  > className="org.apache.catalina.tribes.group.interceptors.TcpFailureDet
> ector"/>
> >
> >
>  > className="org.apache.catalina.tribes.group.interceptors.MessageDispat
> ch15Interceptor"/>
> >
> >
> >
> >  > className="org.apache.catalina.tribes.group.interceptors.StaticMembers
> hipInterceptor">
> >
> >   > className="org.apache.catalina.tribes.membership.StaticMember"
> > domain="mercer" uniqueId="{5,6,7,0,1,2,3,4,0,0,0,0,0,0,1,0}"/>
> >
> >  > className="org.apache.catalina.tribes.membership.StaticMember"
> > port="4001" host="10.255.250.35" domain="mercer"
> > uniqueId="{5,6,7,0,1,2,3,4,0,0,0,0,0,0,0,0}" />
> >
> >  > className="org.apache.catalina.tribes.membership.StaticMember"
> > port="4002" host="10.255.250.35" domain="mercer"
> > uniqueId="{5,6,7,0,1,2,3,4,0,0,0,0,0,0,0,1}" />
> >
> >  > className="org.apache.catalina.tribes.membership.StaticMember"
> > port="4004" host="10.255.250.34" domain="mercer"
> > uniqueId="{5,6,7,0,1,2,3,4,0,0,0,0,0,0,1,1}" />
> >
> > 
> >
> >
> > 
> >
> >  > />  > filter=".*javax\.faces\.resource.*"/>  > className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
> >
> >  > className="org.apache.catalina.ha.deploy.FarmWarDeployer"
> > tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/"
> > watchDir="/tmp/war-listen/" watchEnabled="false"/>
> >
> > 
> >
> >
> 
>
> It looks like you have both multicast AND static membership enabled.
>
> Keichi's presentation on Clustering at ApacheCon Miami (2017) has a
> slide (it's slide #38 here:
> https://events.static.linuxfound.org/sites/events/files/slides/TomcatClu
> ster_3.pdf
> 
> )
> that says that using static-membership requires that you disable
> multicast.
>
> Also, just confirming that you have two Tomcat nodes on one IP address
> (10.255.250.35, ports 4001 and 4002).
>
> Can you post a thread dump of a deadlock situation? Only the
> deadlocked threads should really be necessary to post. Can you
> replicate the deadlock without using your own full application? That
> is, can you create a simple application that can be used to reproduce
> this on a similarly-configured test instance (cluster) of Tomcat nodes?
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluFo/MACgkQHPApP6U8
> pFhG4xAAkUb/Zj9HtwRle8xypc8hrmLfiifo9acIKbb1H3k/2VfYW3EjGqVRzV6c
> E5iGf3JFlnsDEsMIi/oSTObe/aJ15y6z1qfCpud1BRSvi1yHr8jf6W+/M4/QcMNk
> JerBmsx8dgoLteVq34xEld678NftgufaHpd3z5y3HnqfX0MoJkCOaYH5lUbA5MpI
> 61vEngWnWsLvFyTcf+h9PnkxsH5CdA0A9Hjsg56MESAyGoEZ1Jx1MkrIooFLOHVx
> sgxciUIosQy5wqIbpZrZMteB1T6gFSvVsoTCu2ogubJUU216xt3XEezVtksL9Kfc
> +1GbaDeMb65W6GlUU9W61TPb4Id/2mcQ2oUyQERctvIib7GoTcpLJFSHkKlp81GL
> vS3L4siQkSv1M6pIvAtnAJEVPogBgYJXnSVOObpGAmyaDkJt8k1OSCDWqVPmLfUm
> mIlhDGBtngxl0pEM1juLFC2ulaOGS8Vjn5VGZgXDXZVQ6xVmqBDfl9o6x+IB+KDT
> beOGXQKveI18K0qPjxfVtF9OyVgfeLoOzVw2AXAD8QBXorWPlEt53sbInv2r/a3l
> UOKGvxxGpeqmzAtEwm0GxrJsDrfJ2tTp0eIDA94n7d3tuG+zoOgOFaMxXcryieyj
> XXl+4+DjD7YxVAXNfUslP7eYglHh1SdJVc8/MwlH0g0fARY74/o=
> =eKZv
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: [OT] Tomcat Clustering Support

2018-08-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Scott,

I'm no Tomcat-clustering expert, but...

On 8/28/18 13:59, Scott Evans wrote:
>  channelSendOptions="10" channelStartOptions="3">
> 
>  expireSessionsOnShutdown="false" 
> notifyListenersOnReplication="true" mapSendOptions="10" />
> 
>  className="org.apache.catalina.tribes.group.GroupChannel"> 
>  className="org.apache.catalina.tribes.membership.McastService" 
> address="228.1.0.13" port="45522" frequency="500" dropTime="15000" 
> soTimeout="1" domain="mercer"/>  className="org.apache.catalina.tribes.transport.nio.NioReceiver" 
> address="10.255.250.34" port="4003" selectorTimeout="8000" 
> maxThreads="25" />
> 
>  className="org.apache.catalina.tribes.transport.ReplicationTransmitter
">
>
> 
 className="org.apache.catalina.tribes.transport.nio.PooledParallelSend
er"
>
> 
timeout="8000" poolSize="25"
> />   className="org.apache.catalina.tribes.group.interceptors.TcpPingInterc
eptor"/>
>
> 
 className="org.apache.catalina.tribes.group.interceptors.TcpFailureDet
ector"/>
>
> 
 className="org.apache.catalina.tribes.group.interceptors.MessageDispat
ch15Interceptor"/>
>
> 
> 
>  className="org.apache.catalina.tribes.group.interceptors.StaticMembers
hipInterceptor">
>
>   className="org.apache.catalina.tribes.membership.StaticMember" 
> domain="mercer" uniqueId="{5,6,7,0,1,2,3,4,0,0,0,0,0,0,1,0}"/>
> 
>  className="org.apache.catalina.tribes.membership.StaticMember" 
> port="4001" host="10.255.250.35" domain="mercer" 
> uniqueId="{5,6,7,0,1,2,3,4,0,0,0,0,0,0,0,0}" />
> 
>  className="org.apache.catalina.tribes.membership.StaticMember" 
> port="4002" host="10.255.250.35" domain="mercer" 
> uniqueId="{5,6,7,0,1,2,3,4,0,0,0,0,0,0,0,1}" />
> 
>  className="org.apache.catalina.tribes.membership.StaticMember" 
> port="4004" host="10.255.250.34" domain="mercer" 
> uniqueId="{5,6,7,0,1,2,3,4,0,0,0,0,0,0,1,1}" />
> 
> 
> 
> 
> 
> 
>  />  filter=".*javax\.faces\.resource.*"/>  className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
> 
>  className="org.apache.catalina.ha.deploy.FarmWarDeployer" 
> tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" 
> watchDir="/tmp/war-listen/" watchEnabled="false"/>
> 
> 
>
> 


It looks like you have both multicast AND static membership enabled.

Keichi's presentation on Clustering at ApacheCon Miami (2017) has a
slide (it's slide #38 here:
https://events.static.linuxfound.org/sites/events/files/slides/TomcatClu
ster_3.pdf)
that says that using static-membership requires that you disable
multicast.

Also, just confirming that you have two Tomcat nodes on one IP address
(10.255.250.35, ports 4001 and 4002).

Can you post a thread dump of a deadlock situation? Only the
deadlocked threads should really be necessary to post. Can you
replicate the deadlock without using your own full application? That
is, can you create a simple application that can be used to reproduce
this on a similarly-configured test instance (cluster) of Tomcat nodes?

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluFo/MACgkQHPApP6U8
pFhG4xAAkUb/Zj9HtwRle8xypc8hrmLfiifo9acIKbb1H3k/2VfYW3EjGqVRzV6c
E5iGf3JFlnsDEsMIi/oSTObe/aJ15y6z1qfCpud1BRSvi1yHr8jf6W+/M4/QcMNk
JerBmsx8dgoLteVq34xEld678NftgufaHpd3z5y3HnqfX0MoJkCOaYH5lUbA5MpI
61vEngWnWsLvFyTcf+h9PnkxsH5CdA0A9Hjsg56MESAyGoEZ1Jx1MkrIooFLOHVx
sgxciUIosQy5wqIbpZrZMteB1T6gFSvVsoTCu2ogubJUU216xt3XEezVtksL9Kfc
+1GbaDeMb65W6GlUU9W61TPb4Id/2mcQ2oUyQERctvIib7GoTcpLJFSHkKlp81GL
vS3L4siQkSv1M6pIvAtnAJEVPogBgYJXnSVOObpGAmyaDkJt8k1OSCDWqVPmLfUm
mIlhDGBtngxl0pEM1juLFC2ulaOGS8Vjn5VGZgXDXZVQ6xVmqBDfl9o6x+IB+KDT
beOGXQKveI18K0qPjxfVtF9OyVgfeLoOzVw2AXAD8QBXorWPlEt53sbInv2r/a3l
UOKGvxxGpeqmzAtEwm0GxrJsDrfJ2tTp0eIDA94n7d3tuG+zoOgOFaMxXcryieyj
XXl+4+DjD7YxVAXNfUslP7eYglHh1SdJVc8/MwlH0g0fARY74/o=
=eKZv
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: [OT] Tomcat Clustering Support

2018-08-28 Thread Scott Evans
Scott Evans, PMP
Senior Manager
sev...@guilfordgroup.com

GUILFORD GROUP
business driven software solutions
P 317.814.1035 ext. 222 F 317.814.1044
615 West Carmel Drive, Suite 130
Carmel, IN 46032

-Original Message-
From: Christopher Schultz 
Sent: Wednesday, August 15, 2018 3:55 PM
To: users@tomcat.apache.org
Subject: Re: [OT] Tomcat Clustering Support

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Scott,

This list is typically for non-paid support requests, but there really isn't
a great forum for finding Tomcat consultants... other than Google I suppose.

So I'm marking this Off-Topic and replying below.

On 8/15/18 3:43 PM, Scott Evans wrote:
> Our system is on Apache Tomcat Version 8.0.47. OS is Windows Server
> 2012 R2 Datacenter.
>
> We are looking for someone that may be interested in paid contract
> work to assist with troubleshooting and resolving a Tomcat clustering
> issue in our system.
>
> The system is composed of multiple Java PrimeFaces applications
> running in a clustered Tomcat environment which is experiencing
> occasional deadlocking issues from an unknown source requiring the
> Nodes to be cycled in order to resolve.  The issue is only occurring
> in our Production environment and we've determined that the issues are
> occurring at random with the replication threads.

Is it feasible to disable clustering (session replication) completely in
your environment to determine whether the replication itself is the problem,
or perhaps the problem is elsewhere? Disabling clustering should only
degrade your service if (a) you aren't using session-stickiness (which
pretty much everyone should be using) and
(b) you expect a lot of fail-over and (c) it is unacceptable to have a
failed-over user lose their session information.

> We would need someone to help investigate our configuration and
> determine if there are any further changes that can be made to our
> system to catch these deadlock issues before they occur (requiring a
> Node cycle).

Can you post your cluster configuration from conf/server.xml, minus any
secrets that may be in there? If all configs are the same on each node
except for e.g. IP lists, feel free to just post a single one and mention
that the IPs are different.

It would be good to know how many nodes are clustered and the replication
strategy (e.g. delta versus back). The strategy will be obvious from the
configuration. You'll need to tell us the size of the cluster... and perhaps
the deployment model such as "all servers in the same DC" or "50/50 split
between primary DC and secondary DC", etc.

> Please let me know if you or someone you know may be interested or if
> you have further questions I can help answer.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlt0hSUACgkQHPApP6U8
pFiGPg/+PdAG+pVDfZzPWQRCBfjbaSQaRwum7LDNtBY+w5xQjfuS1t3UmST678ft
RGaMRP5Qm/TYuMBI9mzdXrrRIAFaRI/3QAuuyB0jdzKqn18/6fldoJKHpwlzm27x
SE1r5R4tD/lihC1lFWfXEMzOosO2uk7iBZWUv532zKL7TJ0lrLNgVdD5eakX9iVE
dMpnYMbK9CtWHzQZ0LOYcHlXrnAYcr3OqYxZomHCpYsRjHEndfS8gsWqY1t/+gA0
xl0/Vz4lWXYhjmC/PVyN21LL21PA7MNFuywFmt7Xw4sxzgtHXorkOdJcTaqsoz+3
qqItb91vEQ4MvqjW949NApgV1bTaH/juEx8Z99fe9AEAireBCQ6q3qRdvWVzYNqP
+WE0Ghxv5400h1VPYiYoDkFrJUnlPeVortqn1OldEVqoAfQGFW1Gt9wgpEK7Snfx
EVGYG8alAwuvd5sFR9Ge6FcY8NTp+9/awbCwFAPmCCW6dlwdRmYhCRa8tJ9K6MZn
PeeTPFXqBny1HS3BGR5owDn87Mv97eDxTNDfBjAxJP4u4DcMmtvSvM1Uk5QkkI4z
A+rivKxqNw60qR96njWJOyi6A4Nk1OpTSN541snEAegnNm7ad9SMSot349mk80a9
culdRnzLlMCNdv0GwYpoCZBESOckFRQ2G+XrMNqnaCpNVTfCUyo=
=cPO2
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


Please see server.xml contents below.

--We have 4 nodes in the clustered environment
--Add nodes are in the same DC

---start server.xml---




  
  
  
  
  
  
  
  

  
  

















  

  
  























  

  




  






 









 


  

  
  
  

  

  



  
  


  

  







  

  

-end server.xml---

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: org.apache.tomcat.jdbc.pool casting to original connection class

2018-08-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Alex,

On 8/28/18 11:00, Alex O'Ree wrote:
>> From what i understand, the postgres jdbc driver does support
> reading/writing from a result set or command via a input or output
> stream, however from my testing, it looks like it just buffers the
> whole thing in memory.

Yikes. I guess that's what their LargeObject API is intended to avoid.
It's frustrating that they don't provide the same facility through the
standard API. It doesn't seem like it would be that hard to do.

> I actually had one case where i was able to insert 1.2GB of
> content into a bytea column, but could not retrieve it. Something
> about invalid allocation size. Postgres's limit is 1GB and they
> want you to use the large object api. I think it stores it the file
> outside of the normal database table file.

It does. I did a little reading about it this morning because I was
interested. Evidently, those large-objects are stored in a way that
provides absolutely zero authorization-checks against authenticated
users. So if you can log in to the database, you can read all those
files. So if this is a shared database or if you don't 100% trust
every db-user, you might want to think about adding encryption to
those files.

It's unclear to me if they can be modified by other users as well. If
they can be modified but aren't otherwise sensitive, you might want to
add some kind of binary signature to the host table to ensure that the
data hasn't been tampered-with when you weren't looking.

- -chris

> On Tue, Aug 28, 2018 at 10:18 AM Christopher Schultz < 
> ch...@christopherschultz.net> wrote:
> 
> Torsten,
> 
> On 8/28/18 09:27, Torsten Krah wrote:
 Am Dienstag, den 28.08.2018, 09:21 -0400 schrieb Christopher 
 Schultz:
> Interesting. I wonder why Postgres decided not to support
> that through the standard JDBC API.
> 
> Have you tried setting the "compatible" flag on the
> connection just to see if it works for you?
 
 I am curious - afaik the standard JDBC API does not support
 e.g. to use seek() or truncate() on the BLOB to fast forward
 to some position in the file - how would you do that with the
 standard API Christopher - maybe i've missed that feature?
 
 The LargeObject API does support this.
> 
> I've never tried doing random-access reads into BLOBs in a
> database before... that seems like an architectural mistake to me.
> 
> But if I had to, I'd try to:
> 
> ResultSet rs = ...; Blob blob = rs.getBlob("bigfield");
> 
> // Take a chunk out of the middle byte[] chunk =
> blob.getBytes(start, length); // or InputStream readFromMiddle =
> blob.getBinaryStream(strart, length);
> 
> // Truncate the blob blob.truncate(newEndPos);
> 
> The Blob API isn't really that extensive... I'm not sure how you
> could have missed those methods in there. It's really all there
> is.
> 
> Now... if Postgres artificially places a 1GiB limit on everything
> that goes through that API, well, then you are kind of screwed.
> 
> -chris
>> 
>> -
>>
>> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
>> 
> 
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluFbBYACgkQHPApP6U8
pFjr7BAApOj8ow7LxZqqbEhMi6FcYTLQ9kTfXyGyhLPSifKktcSJzZ4dWI4tflZO
zgg6Dhe2eomsXErQ2gVOIVXQmJKRPhO0nnaG5IDkZzSZZNZsQHPrBsObZCpUyf04
rnadkfkt+L4FJ1n5/fdJ+SbY5DNjDaKCJ090j7h3BErbMSz+GAIo1gq6aRHu4Nn/
9vQoT19K3s67DWkvZLPMo+UjprCKBmajYUfqJ2370q4wMEaz8+tg8e63h+FuFnFi
gQiPYE06yfNP+h3IVJcu7aosCfEAgbdjdRaRfrAb2/1NEcUfinuFBp1mQT3ltPje
FYkfz74+JCTWUowX5JLnQWyx3xXzVWWqXNzKUE6IHke2Kaa+x30bIjQNXwH9Sw4u
nAmZm7SfybOZw3UmRbNXPGjSkYYlKe6GUQIEcGvskprsP6r4jqEYNWaVtgBIP7vt
nSvlxIhiBOXChCs0fgGQMXPH01nKEHbg/AKn41lnf9kP842vJ3LPknXJHgDur9PM
MMF9qxtC/BjR99juT7fwL4nBOt5w3WXsLYLvsEtJR2w3JKAZdnll/e6uUGOf+zmQ
GZs6Ra23j3J12S0E9/a8j4GuZP7dhBFmimuxSgxKIEccxxmkgHd+Wbh1d+oTiDEB
QLrAfxD4406Z1SDro/AVq+b2KigjMgj+hWQsrAcJdLZP4OYV36c=
=Y+CN
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: 2018.03.07-2 Bundle issue with tomcat 8 - Post

2018-08-28 Thread Coty Sutherland
On Fri, Aug 17, 2018 at 9:51 AM Olaf Kock  wrote:

>
> On 17.08.2018 15:40, Mandal, Jayanta wrote:
> > Tomcat Version : We upgraded our tomcat environment from bundle
> 2016.10.31-2 to 2018.03.07-2 & suddenly we are seeing all Post method
> stopped working with new bundle.
> >
> >
> > Previous Value
> >
> > Changed Value
> >
> > Bundle
> >
> > 2016.10.31-2
> >
> >
> > 2018.03.07-2
> >
> > Tomcat Server:
> >
> > :  8.0.18-62_patch_01.ep7.el6.-patch-01
> >
> > 8.0.36-17.ep7.el6.0
>

This version information shows that you're using a version of Tomcat
provided by a Red Hat product. For assistance with this, please open a
support case with Red Hat.


> >
> As the downloads on tomcat.apache.org have only 3 digits for the version
> numbers: You're asking about /some/ version that /someone/ has packaged
> according to unknown standards and with unknown patches. Plus, it's a
> version that is already past its end of life, check
> https://tomcat.apache.org/tomcat-80-eol.html
>
> Your best bet is to upgrade to 8.5 or 9.0. Use a stock version from
> tomcat.apache.org if you expect help on this list. If you expect support
> from your OS vendor (or whoever packaged this version for you), they'd
> be the ones to contact. They might provide support beyond this version's
> end-of-life.
>
> Olaf
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: org.apache.tomcat.jdbc.pool casting to original connection class

2018-08-28 Thread Alex O'Ree
>From what i understand, the postgres jdbc driver does support
reading/writing from a result set or command via a input or output stream,
however from my testing, it looks like it just buffers the whole thing in
memory. I actually had one case where i was able to insert 1.2GB of content
into a bytea column, but could not retrieve it. Something about invalid
allocation size. Postgres's limit is 1GB and they want you to use the large
object api. I think it stores it the file outside of the normal database
table file.

On Tue, Aug 28, 2018 at 10:18 AM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Torsten,
>
> On 8/28/18 09:27, Torsten Krah wrote:
> > Am Dienstag, den 28.08.2018, 09:21 -0400 schrieb Christopher
> > Schultz:
> >> Interesting. I wonder why Postgres decided not to support that
> >> through the standard JDBC API.
> >>
> >> Have you tried setting the "compatible" flag on the connection
> >> just to see if it works for you?
> >
> > I am curious - afaik the standard JDBC API does not support e.g. to
> > use seek() or truncate() on the BLOB to fast forward to some
> > position in the file - how would you do that with the standard API
> > Christopher - maybe i've missed that feature?
> >
> > The LargeObject API does support this.
>
> I've never tried doing random-access reads into BLOBs in a database
> before... that seems like an architectural mistake to me.
>
> But if I had to, I'd try to:
>
> ResultSet rs = ...;
> Blob blob = rs.getBlob("bigfield");
>
> // Take a chunk out of the middle
> byte[] chunk = blob.getBytes(start, length);
> // or
> InputStream readFromMiddle = blob.getBinaryStream(strart, length);
>
> // Truncate the blob
> blob.truncate(newEndPos);
>
> The Blob API isn't really that extensive... I'm not sure how you could
> have missed those methods in there. It's really all there is.
>
> Now... if Postgres artificially places a 1GiB limit on everything that
> goes through that API, well, then you are kind of screwed.
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluFWbwACgkQHPApP6U8
> pFgpoxAAtWj6cROWQXgw/r6H/OeoHnOZI262JqajXi7L3QycYzVwNENNQ1v+fKNS
> AegRgAUTDnw0KBk2hPkZHaCEcNIuzshvxA9Vs2ptLynwEjoGXD17+ZXR85uy4Iq/
> bfmnhSAbDRiNg9VoTFw4Vmbx+dNXZUT8jfkGdWWvTH/27yws72vXSLH/bhnAa/IU
> R1eNqmWGbBIQiQaWk2YhSDKWfuQoNUXxiJPYR07u4MhtxGctPHN7nudZb2ZjFGaF
> qCidhoE6/tuNzkpLyMvrvMGHGCR3mP9Vc1UyHtwwckPTCV+rctV2MfpD7RG00K+m
> ABlhCpkw7n0YEGFe2GQet7xF5dB8aLtcv/XimE0/rkQzhzwMkFtRLS30ONwoCiPh
> ID3gLWOmLaAtlCjgO3/FWZbYqxs2yZYyO3xerukHoji4bUYPwfa1otJBQwrjVgZI
> OQGx4Wy173fjRsIXxdUzgw5hpwocLodtu/U+NGWWpTNNq83/1hw8hEaMHl3p729E
> qifq7DDAnws5nlchr2Njf24tScmNtqw1IZV5T2MU3LDvrhi3t5RukuMe5sSyl6S6
> wEqVfSVHNP/IP7XxtpalwbKSiU0D0kwTA9iBmOPA+aQfD05kFKAD9wT9YHgF5wAw
> NGFZBgIaB374sJWZgMQRl/dfHNrrfXV9Lk7OnHk+vXsrakd2O24=
> =6hok
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: org.apache.tomcat.jdbc.pool casting to original connection class

2018-08-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Torsten,

On 8/28/18 09:27, Torsten Krah wrote:
> Am Dienstag, den 28.08.2018, 09:21 -0400 schrieb Christopher
> Schultz:
>> Interesting. I wonder why Postgres decided not to support that 
>> through the standard JDBC API.
>> 
>> Have you tried setting the "compatible" flag on the connection
>> just to see if it works for you?
> 
> I am curious - afaik the standard JDBC API does not support e.g. to
> use seek() or truncate() on the BLOB to fast forward to some
> position in the file - how would you do that with the standard API
> Christopher - maybe i've missed that feature?
> 
> The LargeObject API does support this.

I've never tried doing random-access reads into BLOBs in a database
before... that seems like an architectural mistake to me.

But if I had to, I'd try to:

ResultSet rs = ...;
Blob blob = rs.getBlob("bigfield");

// Take a chunk out of the middle
byte[] chunk = blob.getBytes(start, length);
// or
InputStream readFromMiddle = blob.getBinaryStream(strart, length);

// Truncate the blob
blob.truncate(newEndPos);

The Blob API isn't really that extensive... I'm not sure how you could
have missed those methods in there. It's really all there is.

Now... if Postgres artificially places a 1GiB limit on everything that
goes through that API, well, then you are kind of screwed.

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluFWbwACgkQHPApP6U8
pFgpoxAAtWj6cROWQXgw/r6H/OeoHnOZI262JqajXi7L3QycYzVwNENNQ1v+fKNS
AegRgAUTDnw0KBk2hPkZHaCEcNIuzshvxA9Vs2ptLynwEjoGXD17+ZXR85uy4Iq/
bfmnhSAbDRiNg9VoTFw4Vmbx+dNXZUT8jfkGdWWvTH/27yws72vXSLH/bhnAa/IU
R1eNqmWGbBIQiQaWk2YhSDKWfuQoNUXxiJPYR07u4MhtxGctPHN7nudZb2ZjFGaF
qCidhoE6/tuNzkpLyMvrvMGHGCR3mP9Vc1UyHtwwckPTCV+rctV2MfpD7RG00K+m
ABlhCpkw7n0YEGFe2GQet7xF5dB8aLtcv/XimE0/rkQzhzwMkFtRLS30ONwoCiPh
ID3gLWOmLaAtlCjgO3/FWZbYqxs2yZYyO3xerukHoji4bUYPwfa1otJBQwrjVgZI
OQGx4Wy173fjRsIXxdUzgw5hpwocLodtu/U+NGWWpTNNq83/1hw8hEaMHl3p729E
qifq7DDAnws5nlchr2Njf24tScmNtqw1IZV5T2MU3LDvrhi3t5RukuMe5sSyl6S6
wEqVfSVHNP/IP7XxtpalwbKSiU0D0kwTA9iBmOPA+aQfD05kFKAD9wT9YHgF5wAw
NGFZBgIaB374sJWZgMQRl/dfHNrrfXV9Lk7OnHk+vXsrakd2O24=
=6hok
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: org.apache.tomcat.jdbc.pool casting to original connection class

2018-08-28 Thread Torsten Krah
Am Dienstag, den 28.08.2018, 09:21 -0400 schrieb Christopher Schultz:
> Interesting. I wonder why Postgres decided not to support that
> through
> the standard JDBC API.
> 
> Have you tried setting the "compatible" flag on the connection just
> to
> see if it works for you?

I am curious - afaik the standard JDBC API does not support e.g. to use
seek() or truncate() on the BLOB to fast forward to some position in
the file - how would you do that with the standard API Christopher -
maybe i've missed that feature?

The LargeObject API does support this.

kind regards

Torsten

smime.p7s
Description: S/MIME cryptographic signature


Re: org.apache.tomcat.jdbc.pool casting to original connection class

2018-08-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Alex,

On 8/27/18 20:47, Alex O'Ree wrote:
> On Mon, Aug 27, 2018, 7:19 PM Christopher Schultz < 
> ch...@christopherschultz.net> wrote: On 8/24/18 16:08, Alex O'Ree
> wrote:
 I have a use case where i need to downcast a pooled database 
 connection down to the native class that is in use for the
 driver. Unfortunately I don't see any APIs that I can use to
 do this. Is there any backdoors or mechanisms I can use?
 
 Background, I'm using postgres with tomcat 8.5 and need to
 access some postgres specific apis, (the large binary object
 api). I've tried with both the tomcat based pool and the dbp2
 connection pooling too.
>> 
>> What's wrong with the existing JDBC APIs for working with BLOBs?
>> It's been a really long time since anyone has really had to
>> down-cast JDBC interface types to their implementation types to
>> get around deficiencies in the APIs.
> 
> I'm storing large files. Postgres has a limit for blobs and uses a 
> different api for larger stuff.  Cut off is 1gb

Interesting. I wonder why Postgres decided not to support that through
the standard JDBC API.

Have you tried setting the "compatible" flag on the connection just to
see if it works for you?

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluFTFAACgkQHPApP6U8
pFj9Bw//dowFYiOISbNuF4v9wKkP+QqH9duSGtEPcQ/Og17YagGi4Soci1kI9xde
JTIi4ie95Xd5Sa0W5ns/geqFD2qQA5GmVbb6GfwRHn+MRslChnATHB842+mmLHE7
9tOfXfuMmlHj1//rAL8f23y6wcFq2NfTZNLxL+VwI3hCbv/hxJtA8jIToBn7kqBm
cF7aA/StfpVwTFKY+r81G8rvxuD+CXuoASsDRHJl6h3bjqnu+iDvtqL1UBBnoUo4
K/GUbKvbYoex2zPgIyqnZM0DuVUtITuYpzZLfT8Yy1rVvXj7YcPZBsP+nC6B0pcQ
X+N4770oUMZ9gxlrnKq3kyryuEwsX5Pg8dHcKUPp1iD6df5qajsQx03hKI9OgIaq
Wamovoj3xvHR9UFvxaGO/7iykMK5gYc3HsoWM7TCxk0Plfm3kLJWMv7SQQmLZVLB
dg5iMy43Ne2J9tYJUe9O0tp6w7CJYtj77+ngbhuUmZlct+nGS/GRkGAak/GkAgRZ
tkmpy6UqP6ExPPATYesmy8yinLh09HJjXmkXksksdrM1M2H9vH9NxpFDf4Yu3kne
2HXIAun1q7UVKiZ831u0dyPHHcpzEfKyB5U18vFctrxHardBAabLaB0BMQeSvs/1
UtUafOomMvRqxisKZExBRUoO2Q92XIpJIYiUkbA9S35/ZPozckE=
=IbSz
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



[OT] Re: Tomcat Valve

2018-08-28 Thread logo

Nice one Christopher. Didn't know that yet. Will bookmark.

Am 28.08.2018 05:13, schrieb Christopher Schultz:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Lance,

On 8/27/18 19:21, Christopher Schultz wrote:

Lance,

On 8/24/18 11:52, Campbell, Lance wrote:

Tomcat 9 Use Case 1:  I want to store the last N number of URLs
sent to Tomcat 9 application.  Then if Tomcat shuts down I want
to write out these last N number of URLs to the log file.



Strategy: I figured I would use a valve to keep track of the last
N number of URLs.  However I don’t know how to tell when the
valve is shutting down.



Does anyone have any suggestions?


Sounds like an X-Y problem: http://xyproblem.info/

Maybe you can tell us what Y is in this case?


Uhh... actually I meant "what is X, here?" ;)

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluEveUACgkQHPApP6U8
pFh5Og//djlqDz0WsiVlHg+Z6w6cGUiXAOd8FiQOMPPvgps9fl0rLU5bMteyRO4D
YKrU8zECfbvZxDnt1aVtxcqrKVaVvu/YyObIUG/6xQAN7pqEz3iJJ/7tWLhaGvHn
/fw+8oFHiO2rrodr9M8OFpeYklhqLkP1N0yxZVn9pfUQKcN0hWgOEwdHL2TWicZm
kx2MRs2hr2SRTs0dxmIYNVpy6ajRL8CDYY02rItCWGZZ3BLLNaePvRfkBn+BMfdm
W8XF1vArV8JvMkydvNk6Nq1U0uxRCf8eeDuT7DtJ8ls6j8FFIA34OuLmiXao+5Bl
E6YfKcpjJgxxlJqbuz3UTPiSSJ7HK/XkR1lZhz/GSJP5BhoCGFv8wiEwscH2b6pF
sbsT8gn1OqfVgHZPYMViqxXHxpLitbV1ZrtbmtY0QGyyGW8lUOWWTO/Jor1CTgKo
Jh+G1FOT4L5q0bE1WmloRxjwj+lg7beMwGjLKp9+Lu+yZRjvz+bJUJNacHr5ysG2
EQiCTKGHdaImtSs0vg0N8t13RmjgMhZljMxeX46bk4nZ+MsAX1SxnBN8kZdXVHKy
aVXIez73a3FhjLy0+fVZlObsHWPvHtvSpX3VN3Slnc0g5Lm6X2feeZLpnv6irs3y
Wos/zAFA5opTa4pBoqz6+q9A5Btx3EHJQAK9XqagqZbYWjJ/TLU=
=CJN/
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org