Coder Social home page Coder Social logo

carbon-analytics-common's Introduction

Carbon Analytics Common


Branch Build Status
master Build Status

This project contains compontents which implements common functionalities used in WSO2 analytics platform.

Carbon Analytics Common repo contains following components:

  • data-bridge

How to Contribute

Contact us

WSO2 Carbon developers can be contacted via the mailing lists:

carbon-analytics-common's People

Contributors

anugayan avatar dilini-muthumala avatar dnwick avatar dunithd avatar gimantha avatar gokul avatar grainier avatar inosh avatar keizer619 avatar ksdperera avatar lafernando avatar lasanthafdo avatar minudika avatar mohanvive avatar nirandaperera avatar nirmal070125 avatar niveathika avatar pcnfernando avatar rajeev3001 avatar ramindu90 avatar ruwiniwj avatar sacjaya avatar sajithshn avatar sinthuja avatar suhothayan avatar swsachith avatar thilia avatar tishan89 avatar wggihan avatar wso2-jenkins-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carbon-analytics-common's Issues

build error

when i build the source in windows10 system using "clean install -Dmaven.skip.test=true" command
the error occours:

build.docx

why?

Deadlock in QueueInputEventDispatcher

Description:

This issue happens on a 2 node min-HA DAS 3.1.0 setup.

Think of a scenario where the QueueInputEventDispatcher.onEvent method acquires the thread barrier of QueueInputEventDispatcher and then waiting at the BlockingEventQueue.put since the queue is full.

Current code:

@Override
    public void onEvent(Event event) {
        try {
            threadBarrier.lock();
            eventQueue.put(event);
            threadBarrier.unlock();
        } catch (InterruptedException e) {
            log.error("Interrupted while waiting to put the event to queue.", e);
        }
    }

You'll see a thread stack like below in such a scenario;

"JMSThreads3f6df5b2-0a40-479a-82d0-da2c0c05fae9-1" #929 prio=5 os_prio=0 tid=0x00007fb7e0288000 nid=0x297c waiting on condition [0x00007fb69ccb2000]
   java.lang.Thread.State: TIMED_WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000004cf79fc48> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2163)
	at org.wso2.carbon.event.receiver.core.internal.management.BlockingEventQueue.put(BlockingEventQueue.java:66)
	at org.wso2.carbon.event.receiver.core.internal.management.QueueInputEventDispatcher.onEvent(QueueInputEventDispatcher.java:68)
	at org.wso2.carbon.event.receiver.core.internal.EventReceiver.sendEvent(EventReceiver.java:298)
	at org.wso2.carbon.event.receiver.core.internal.EventReceiver.processMappedEvent(EventReceiver.java:222)
	at org.wso2.carbon.event.receiver.core.internal.EventReceiver$MappedEventSubscription.onEvent(EventReceiver.java:355)
	at org.wso2.carbon.event.input.adapter.core.internal.InputAdapterRuntime.onEvent(InputAdapterRuntime.java:110)
	at org.wso2.carbon.event.input.adapter.jms.internal.util.JMSMessageListener.onMessage(JMSMessageListener.java:61)
	at org.wso2.carbon.event.input.adapter.jms.internal.util.JMSTaskManager$MessageListenerTask.handleMessage(JMSTaskManager.java:643)
	at org.wso2.carbon.event.input.adapter.jms.internal.util.JMSTaskManager$MessageListenerTask.run(JMSTaskManager.java:542)
	at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Now, in a 2 node HA cluster, there's a periodic state sync that is happening and when the state sync is started, it'll first pause all the receivers, then pause all the processors and then ask all the snapshotables to return their current state. QueueInputEventDispatcher.getState method looks like below;

@Override
    public byte[] getState() {
        threadBarrier.lock();
        byte[] state = objectToBytes(eventQueue);
        threadBarrier.unlock();
        return state;
    }

Now, since all the processors are blocked, there would be no one to consume from the BlockingEventQueue which is already full. But remember, that the thread barrier lock is already being acquired by that thread, hence the state sync thread will wait at the threadBarrier.lock(); of the getState method. Following is a sample thread state;

"pool-26-thread-4" #357683 prio=5 os_prio=0 tid=0x00007fdee80ee800 nid=0x7d15 waiting on condition [0x00007fdda58da000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000004db14b310> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
	at org.wso2.carbon.event.receiver.core.internal.management.QueueInputEventDispatcher.getState(QueueInputEventDispatcher.java:83)
	at org.wso2.carbon.event.receiver.core.internal.CarbonEventReceiverManagementService.getState(CarbonEventReceiverManagementService.java:50)
	at org.wso2.carbon.event.processor.manager.core.internal.HAManager.getState(HAManager.java:184)
	at org.wso2.carbon.event.processor.manager.core.internal.CarbonEventManagementService.getState(CarbonEventManagementService.java:258)
	at org.wso2.carbon.event.processor.manager.core.internal.thrift.ManagementServiceImpl.takeSnapshot(ManagementServiceImpl.java:35)
	at org.wso2.carbon.event.processor.manager.core.internal.thrift.service.ManagementService$Processor$takeSnapshot.getResult(ManagementService.java:174)
	at org.wso2.carbon.event.processor.manager.core.internal.thrift.service.ManagementService$Processor$takeSnapshot.getResult(ManagementService.java:158)
	at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
	at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
	at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:285)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Hence, there arises a deadlock situation.

Suggested Labels:

Suggested Assignees:

Affected Product Version:
DAS 3.1.0
CEP 4.2.0

OS, DB, other environment details and versions:
2 node HA

Steps to reproduce:

  • needs to make the queue full and let the state sync run during such a time.

Related Issues:

User properties for getUser in 'external' IdP client includes entire json response

Description:
User properties for getUser in 'external' IdP client includes entire json response

Suggested Labels:
Improvement

Suggested Assignees:
Niveathika

Affected Product Version:
Product-SP:4.0.0-Alpha

OS, DB, other environment details and versions:
Linux, Java 8

Steps to reproduce:

  1. Override default IdP client implementation by configs
    auth.configs:
    type: 'external'

  2. getUser from the IdPClient OSGi service

DAS 3.1.0 RDBMS publisher fails if very first event has null attributes

Description:
When very first event has null attributes even valid event will fail as attribute.getType() is null. This is happening because initializeDatabaseExecutionFromMessage() is not properly initializing executionInfo related to RDBMS Publisher as first message does not have those info(because of null). We may have to patch that behavior to re-initialize if type is null.

Affected Product Version:
DAS 3.1.0 WUM updated
OS, DB, other environment details and versions:

Steps to reproduce:

  1. Create an event stream with few int type attributes
  2. Add a RDBMS publisher for that
  3. Inject event with null attributes to that stream. This has to be the very first event to the publisher. For inserting null events you can utilize a join query.

`@Import('org.wso2.event.sensor.stream:1.0.0')
define stream input (meta_timestamp long, meta_isPowerSaverEnabled bool, meta_sensorId int, meta_sensorName string, correlation_longitude double, correlation_latitude double, humidity float, sensorValue double);

@export('output1:1.0.0')
define stream output1 (sensor_name string, sensorname string, sensorId int);

define table table1(meta_sensorName string, meta_sensorId int);

from input left outer join table1 on (input.meta_sensorName == table1.meta_sensorName)
select input.meta_sensorName as sensor_name, table1.meta_sensorName as sensorname, table1.meta_sensorId as sensorId
insert into output1;`

  1. Then use another query or event simulator to send valid events

No support to override oAuth app credentials

Description:
Appcontext should not be used in naming of the OAuth app in DCR. This will be useful in the cases the client secret of the oAuth app is regenerated.

Suggested Labels:
Improvement

Overriding default configs for 'local' IdPClient throws error

Description:
Overriding default configs for 'local' IdPClient throws exception pointing to a configurations error

Suggested Labels:
Bug

Suggested Assignees:
Niveathika

Affected Product Version:
Product-SP:4.0.0-Alpha

OS, DB, other environment details and versions:
Linux, Java 8

Steps to reproduce:

  1. Add the following configs to deployment.yaml
    auth.configs:
    type: local
    users:
    • user:
      username: 'admin'
      password: '******'
      roles: 1
      roles:
    • role:
      id: 1
      display: 'admin'

Make data-bridge-conf.xml self explanatory

Description:
Data-bridge-config.xml contains some fields which are not clearly explained. Let's improve the config so that each field is explained clearly.

Affected Product Version:
3.0.1, 3.1.0, 3.2.0

Unclear role configurations

Description:
Role configurations are as below,

  • role:
    id:
    display

Here the display is not clear and can be improved by using dispalyName

Suggested Labels:
Improvement

Task was rejected due to the worker threads being busy

Description:

The Following ERROR observed in wso2das-3.1.0+1536386291526.full.zip when publishing events with a heavy load to DAS.

TID: [-1] [] [2018-09-20 13:45:37,441] WARN {org.apache.thrift.server.TThreadPoolServer} - Task has been rejected by ExecutorService 9 times till timedout, reason: java.util.concurrent.RejectedExecutionException: Task org.apache.thrift.server.TThreadPoolServer$WorkerProcess@410550ea rejected from java.util.concurrent.ThreadPoolExecutor@1c374152[Running, pool size = 20, active threads = 20, queued tasks = 0, completed tasks = 34971] {org.apache.thrift.server.TThreadPoolServer}

Affected Product Version:
DAS 3.1.0

Error on Kafka Adapter

When I create a KafkaReceiver in WSO2-CEP using management console,
i read this error on server console.

ERROR {org.wso2.carbon.event.input.adapter.core.internal.InputAdapterRuntime} -  Error initializing Input Adapter 'kafkaReceiver, hence this will be suspended indefinitely, Cannot access kafka context due to missing jars
org.wso2.carbon.event.input.adapter.core.exception.InputEventAdapterRuntimeException: Cannot access kafka context due to missing jars
    at org.wso2.carbon.event.input.adapter.kafka.KafkaEventAdapter.createConsumerConfig(KafkaEventAdapter.java:114)
    at org.wso2.carbon.event.input.adapter.kafka.KafkaEventAdapter.createKafkaAdaptorListener(KafkaEventAdapter.java:132)
    at org.wso2.carbon.event.input.adapter.kafka.KafkaEventAdapter.connect(KafkaEventAdapter.java:66)
    at org.wso2.carbon.event.input.adapter.core.internal.InputAdapterRuntime.start(InputAdapterRuntime.java:72)
    at org.wso2.carbon.event.input.adapter.core.internal.InputAdapterRuntime.startPolling(InputAdapterRuntime.java:62)
    at org.wso2.carbon.event.input.adapter.core.internal.CarbonInputEventAdapterService.startPolling(CarbonInputEventAdapterService.java:187)
    at org.wso2.carbon.event.receiver.core.internal.CarbonEventReceiverService.startPolling(CarbonEventReceiverService.java:620)
    at org.wso2.carbon.event.receiver.core.internal.CarbonEventReceiverManagementService.startPolling(CarbonEventReceiverManagementService.java:99)
    at org.wso2.carbon.event.processor.manager.core.internal.CarbonEventManagementService$2.run(CarbonEventManagementService.java:184)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: kafka/consumer/ConsumerConfig
    at org.wso2.carbon.event.input.adapter.kafka.KafkaEventAdapter.createConsumerConfig(KafkaEventAdapter.java:112)
    ... 15 more
Caused by: java.lang.ClassNotFoundException: kafka.consumer.ConsumerConfig cannot be found by org.wso2.carbon.event.input.adapter.kafka_5.0.3
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 16 more

Template Manager not escaping characters depending on the artifact type file format

Description:
When using the template manager to set an HTML formatted text as the email template from the template manager an error occurs in the deployment process. UI shows the following error while the console shows no errors.

screenshot_error_when_adding

After debugging I found out that this occurs because the HTML tags are not properly encoded before they replace the parameter placeholders in the template. This leads to the email publisher (saved as an XML) to fail during parsing.

This might occur in all the deployers depending on the file format used to save. The parameter values entered by the user in the template manager should be encoded.

The same issue is present in the editor in the admin UI that appears (The text editor) when editing an event publisher after adding it. This happens because the text editor decodes the &lt; and &gt; characters back to "<" and ">" symbols when loading the configuration.

screenshot_error_when_updating_event_publisher

Suggested Labels:
Bug, Minor

Affected Product Version:
WSO2 DAS 3.1.0

OS, DB, other environment details and versions:
N/A

Steps to reproduce:

  1. Create a domain template for an email event publisher with the following template.
    <template type="eventpublisher">
      <![CDATA[
        <?xml version="1.0" encoding="UTF-8"?>
        <eventPublisher name="EmailNotifier" processing="enable" statistics="disable"
          trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
          <from streamName="org.wso2.carbon.identity.policy.password.ExpiredPasswords" version="1.0.0"/>
          <mapping customMapping="enable" type="text">
            <inline>$emailTemplate</inline>
          </mapping>
          <to eventAdapterType="email">
            <property name="email.subject">Expired Passwords</property>
            <property name="email.address">{{email}}</property>
            <property name="email.type">text/plain</property>
          </to>
        </eventPublisher>
      ]]>
    </template>
    Set the parameter as follows
    <parameter name="emailTemplate" type="string">
        <displayName>Email template to be used to send notifications</displayName>
        <description>The template to be used to sending notifications about expired passwords</description>
        <defaultValue>
            Hi {{username}},&lt;br&gt;
            &lt;br&gt;
            Please login.
            &lt;br&gt;
            Thank you!&lt;br&gt;
            &lt;br&gt;
            Regards,&lt;br&gt;
            WSO2&lt;br&gt;
        </defaultValue>
    </parameter>
  2. Add a new scenario with an html formatted text as the email template and set an HTML formatted text as the value for the email template. (You may save the default value since it is an html formatted text)

Related Issues:
Jira Issue https://wso2.org/jira/browse/DAS-625

[idp-client] Missing MSSQL and Oracle database queries

Description:
The default MSSQL and Oracle database queries for the IDP-client are missing.

Suggested Labels:

Suggested Assignees:

Affected Product Version:
SP-4.1.0

OS, DB, other environment details and versions:

Steps to reproduce:

Related Issues:

Queue input event dispatchers can exist execution causing data blockage in entire server

Description:
This issue was initially discovered in wum updated DAS 3.1.0 with analytics features installed. But should be reproducible with DAS 3.2.0. In a HA setup when we are having an stream with artibary maps, it will throw a buffer overflow exception and QueueInputDispatcherWorker will quit. This will cause that BlockingQueue to fill up. When the queue is full Databridge threads will begin to wait on the queue causing all Databridge threads to block and halt all thrift/binary traffic.

Solution for this is two folds.

  1. We need to investigate below bufferOverflow exception and fix that and also make QueueInputEventDispatchers to stay in the loop no matter what happens.
TID: [-1234] [] [2018-06-21 09:04:09,640] ERROR {org.wso2.carbon.event.receiver.core.internal.management.AbstractInputEventDispatcher} -  Error in dispatching events:null {org.wso2.carbon.event.receiver.core.internal.management.AbstractInputEventDispatcher}
java.nio.BufferOverflowException
	at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:189)
	at java.nio.ByteBuffer.put(ByteBuffer.java:859)
	at org.wso2.carbon.event.processor.manager.commons.transport.client.TCPEventPublisher.sendEvent(TCPEventPublisher.java:229)
	at org.wso2.carbon.event.processor.manager.core.internal.EventHandler.syncEvent(EventHandler.java:99)
	at org.wso2.carbon.event.processor.manager.core.internal.CarbonEventManagementService.syncEvent(CarbonEventManagementService.java:292)
	at org.wso2.carbon.event.receiver.core.internal.management.QueueInputEventDispatcher$QueueInputEventDispatcherWorker.run(QueueInputEventDispatcher.java:197)
  1. Make Databridge threads to drop events and return if it waited for a queue for a pre-configured amount of time.

Please refer : "Possible issue in log analyzer data publishing"

Affected Product Version:
DAS 3.1.0, DAS 3.2.0 and associated analytics distribution

Steps to reproduce:

  1. Get WUM updated APIM analytics and deploy in HA mode
  2. Enable log analyzer analytics
  3. Send events

Theoretically this should get reproduced in latest DAS also with a stream which has an arbitrary map.

[permission-provider] - Database table creation queries are missing.

Description:
The permission provider uses two table which holds the application related information,

  1. PERMISSIONS
  2. ROLE_PERMISSIONS

The embedded database (WSO2_PERMISSIONS_DB H2 database) has the above default tables, but if we point the data source into the different database there is no database script neither internal default queries to generate the required tables.

Suggested Labels:

Suggested Assignees:

Affected Product Version:
SP-4.1.0

OS, DB, other environment details and versions:

Steps to reproduce:

Related Issues:

[permission-provider] Data redundancy problems in ROLE_PERMISSIONS table (Permission Database).

Description:
According to the embedded database[PERMISSION_DB.h2] record output for the ROLE_PERMISSIONS table, identified data redundancy problems as follows:

screen shot 2018-05-01 at 1 17 07 am

Verify whether we need to avoid such data duplication by defining the table schema or fixing the permission provider implementation.

Suggested Labels:

Suggested Assignees:

Affected Product Version:
SP-4.1.0

OS, DB, other environment details and versions:

Steps to reproduce:

Related Issues:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.