what is the exception type of this kind [Macromed...
# cfml-general
s
what is the exception type of this kind [Macromedia][SQLServer JDBC Driver]Connection reset by peer: socket write error i do not want to use use any, can i use custom and if yes what i need to pass in the custom
c
usually happens when your network/VPN drops out or the database becomes unavailable
w
why don't you want to use any? it only makes sense to not use any when you have multiple cfcatch blocks; if you have only one, it hardly matters
s
I’ve experienced those errors related to database connections. Network is only part of the connection process. CF Admin has settings, pooling and timeout settings as well as your database. Could be in those areas as well.
r
I believe the exception type is “database”
w
you can find out specifically by simply dumping #cfcatch# and looking at the type value. ultimately though, as said above that error is thrown when cf can't connect to the db server, most likely a dropped vpn connection if that's how yours is set up
b
the type is database and it happens when pooled connections are cached but lose the ability to connect to the database/server long enough for at least 1 query to fail. Once it fails, it wont recover until its cleared and the pooled connection recreated (at least that has been my experience with it... for many years). You can wait for the pooled connection to clear on its own and get recreated with the next request, you can restart lucee/acf or you can go into the datasource configuration in the lucee/acf admin, disable connections, save (which kills the pooled connection), re-enable connections, save and, assuming the server connection is good again, everything should be fine.
In my experience, most of my apps are useless without a database connection so the downtime from restarting to fix an error that has pretty much 100% of functionality unavailable has never been a concern... so I've always just restarted the cf instance. We often see this when database servers are worked on during our maintenance windows. You can recreate it yourself, I'm sure, by getting into your app then killing the database server/service and then trying to make a requst in the app again.
w
that was a coherent, well-reasoned response @bhartsfield. too bad it was wasted on this topic. you may now return to your normal gibberish and political brinksmanship.
b
great minds and all... thought the same thing 🙂
well, the wasted part
✔️ 1
you know me too well for me to publicly ask what dangerous pass-time you are talking about lol
w
all shall be revealed at a time when it most benefits me.
s
you are all right, it happened when our sqlbackups were done, so there was a disconnect, i have used many other cfcatch statements each type with specific message so i know why it arrived on that page, that is why i cannot use any, because it will just not let me entirely what went wrong, and when you say dump cfcatch, it will show the types, but the sql are backup and even if i dump, i will not get that error, so i want to catch it when it happens next time, so i show a nice error when it comes to that section
as an example, is there anything in stacktrace which i can use along with cfthrow to create that kind of exception
s
what about this btw this way i still jump into any and is it possible, if the if matches then show else exit out of it
Copy code
<cftry>
    <cfcatch type="any">
        <cfif cfcatch.message eq '[Macromedia][SQLServer JDBC Driver]Connection reset by peer: socket write error'>
            <cfset databasseissue = true>
        </cfif>
    </cfcatch>

</cftry>
because i have a seperate cfcatch for database the database one should get nested in the any or keep it seperate will still work