Comments (3)
On Tue, Feb 12, 2013 at 11:38 PM, netsiphon [email protected] wrote:
I recently experienced unexplained transaction errors, ending up with barnyard quitting after the default transaction error threshold, which didn't fit any of the well known issues like duplicate sensors, permission issues, etc.
After debugging to follow the function path I realized that my problem was with my mysql config having a wait_timeout of 300 seconds(default is 28800)
and my low event rate. As you would expect, whenever the events would be spaced more than 300 seconds apart there would be a transaction error
and then in the next transaction the event would be inserted. Leaving to the default wait_timeout would of course fix it or just setting a more reasoned
value would fix it as well, as long as the event rate was higher than that value.
As far as i know MySQL wait_timeout is a server parameter, you can
probably also set it on client basis but by default we do not support
this option,
you could create a feature request so that in the barnyard2 2.x
version the mysql output plugin would support more mysql options (same
goes for other DBMS).
And if you want a quick patch you could probably patch the connection
code so that each connection set its own timeout option for the
socket.
http://dev.mysql.com/doc/refman/5.6/en/mysql-options.html
see MYSQL_OPT_CONNECT_TIMEOUT
And you could patch it right in the code of the by2 function
MYSQL_ManualConnect in src/output-plugins/spo_database.c below or
before
The reason it even matters I guess is that the transaction error threshold never gets reset with a successful transaction now(2-1.11).
I understand that it may have caused loops but it is conceivable for there to be transaction errors that over a a period of time kill the
process that don't have to be due to the wait_timeout.
Unfortunately it has been like this since the new plugin has been out,
the main reason is that this can enable you to diagnose some issue.
You can allways change the value adding the connection_limit argument
to the database output and using a large value
#define UINT_MAX 4294967295U (since its a 32bit unsigned integer).
Also I think(correct me if I'm wrong) the transaction error threshold only applies to events and not to processing signature information or other db related functions.
So in the case of processing a never before seen signature the process will immediately quit as the transaction error occurred during the signature cache update(again correct me if I'm wrong).
This will happen on any type of SQL operation, since before any
SELECT,UPDATE,INSERT there is a connection descriptor check, and if
the connection_limit is reached
the process will stop.
Let us know what you think about those.
-elz
from barnyard2.
I'm ok with upping the connection_limit per database output, and I did so just to test that the option would work, but subsequently the application quit even though I could be pretty certain that the connection_limit wasn't reached.
That is why I was asking for clarification that indeed the transaction error threshold and connection limit applies to all SQL operations and that there aren't any special cases where a single error would completely bypass the retry mechanism.
If you believe there isn't I will just retest and confirm whether my errors are..."erroneous"...lol
from barnyard2.
I faced the same issue: I was getting a lot of insert errors which caused Barnyard to stop/halt. After looking around noticed this response and tried using MYSQL_OPT_CONNECT_TIMEOUT, as suggested by binf. But that didn't fix the issue, the connection was getting lost after wait_timeout value was reached. I managed to fix it by setting wait_timeout when the session was started:
mysql_options(data->m_sock, MYSQL_INIT_COMMAND, "/*!40101 set @@session.wait_timeout=92000 */");
This seems to work for me so I've added a configuration variable "mysql_wait" which can be set to a value that suits the environment on which Barnyard is running.
I've created a pull request with the patch I used (done against bug-fix-release branch), maybe it helps someone else too:
binf#1
from barnyard2.
Related Issues (20)
- Barnyard2 2.1.13 sending alerts to remote syslog server.
- Need for a release for all distributions
- Will not compile with libpcap.1.9.0 HOT 20
- unable to write to the mysql database HOT 2
- Barnyard2 can't record to count event.
- Make command gives error in Barnyard2 compile HOT 1
- Error: There's no second layer header available for this datalink. HOT 1
- barnyard2 not read new spool file HOT 3
- ./configure --with-mysql --with-mysql-libraries=/usr/lib64/mysql/ && make && make install;mysql8.0 HOT 2
- Compilation error
- BASE not getting Updated
- mysql Fatal Error: Duplicate key HOT 10
- problem in ipv6 storage
- barnyard2 u2 alert_fast using GRE IP, not encapsulated IP.
- Change the output database
- HELP ME , how i can make barnyard2 HOT 1
- ./configure: line 14409: syntax error near unexpected token `0.9.6,'
- Can't make barnyard2 due to missing glsl link
- Unable to compile in ODBC HOT 1
- MariaDB fixed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from barnyard2.