Notifications in 5.2 sent 3 times

Silverweb 3 years ago

Hello!
Since upgrade from 5.0 to 5.2 every notification (mail and sms) comes 3 times.
Any idea how to solve this?

Tahnks,
Chris

Anton Tananaev 3 years ago

If you have a way to reproduce the issue on a clean server, please create a bug ticket with details.

The same thing happens to me the events in the notifications appear 2,3 and 4 times on the device but if I go to the report it is correct only this 1 time

https://www.dropbox.com/s/z1l4vr8nvk8v0r4/Traccar%20notificacion%20repeat.PNG?dl=0

Anton Tananaev 3 years ago

I need steps to reproduce it. Can I have access to take a look?

You can view it in the events part, there will be reproduced what you send in the attached photo, I will send you the credentials to the support email

Spiros Kran 3 years ago

I have the same problem. I figured out that it has to do with the connections. If as an admin, you create a notification and then connect it to users ( who are also connected to the same group of devices) then everybody gets double notifications. But if you create seperate notifications for each user and then disconnect t all of them from yourself (admin), then everybody gets only one. But of course its very difficult to seperate the notifications, because all of them have the same name.

https://www.dropbox.com/s/whnf9krmrw24kmm/Screenshot%202022-07-20%20at%207.43.22%20PM.png?dl=0

Yes, you are absolutely right @Spiros Kran I did these steps and I only received a notification.

@Anton Tananaev is it possible to group them for the next version or will they not be reconfigured as they were in the previous version?

Anton Tananaev 3 years ago

We'll work on a fix.

Anton Tananaev 3 years ago

This should fix the issue with duplicate notifications:

https://github.com/traccar/traccar/commit/d42f935e4119fb87002b8b275c4237290ef7f12b

ok, I understand we just have to recompile adding those lines, I am going to download a VM with ubunto to be able to make the changes and I will inform you if everything worked correctly

Anton Tananaev 3 years ago

You just need to recompile the JAR file.

It gives me the attached error when recompiling, could you send the file already compiled?

root@ubuntu:/home/jrodriguez/Downloads/traccar# ./gradlew assemble

> Task :compileJava
/home/jrodriguez/Downloads/traccar/src/main/java/org/traccar/session/cache/CacheManager.java:64: error: variable deviceLinks is already defined in class CacheManager
    private final Map<Long, Map<Class<? extends BaseModel>, Set<Long>>> deviceLinks = new HashMap<>();
                                                                        ^
/home/jrodriguez/Downloads/traccar/src/main/java/org/traccar/session/cache/CacheManager.java:251: error: variable links is already defined in method unsafeAddDevice(long)
        Map<Class<? extends BaseModel>, Set<Long>> links = new HashMap<>();
                                                   ^
/home/jrodriguez/Downloads/traccar/src/main/java/org/traccar/session/cache/CacheManager.java:263: error: incompatible types: bad return type in lambda expression
                links.computeIfAbsent(Group.class, k -> new LinkedHashSet<>()).add(group.getId());
                                                                         ^
    cannot infer type arguments for LinkedHashSet<>
      reason: no instance(s) of type variable(s) E exist so that LinkedHashSet<E> conforms to List<Long>
  where E is a type-variable:
    E extends Object declared in class LinkedHashSet
/home/jrodriguez/Downloads/traccar/src/main/java/org/traccar/session/cache/CacheManager.java:272: error: incompatible types: inference variable R has incompatible bounds
                links.put(clazz, objects.stream().map(BaseModel::getId).collect(Collectors.toSet()));
                     ^
    equality constraints: Set<T#2>
    lower bounds: List<Long>,Object
  where R,A,T#1,T#2 are type-variables:
    R extends Object declared in method <R,A>collect(Collector<? super T#1,A,R>)
    A extends Object declared in method <R,A>collect(Collector<? super T#1,A,R>)
    T#1 extends Object declared in interface Stream
    T#2 extends Object declared in method <T#2>toSet()
/home/jrodriguez/Downloads/traccar/src/main/java/org/traccar/session/cache/CacheManager.java:279: error: incompatible types: inference variable R has incompatible bounds
            links.put(User.class, users.stream().map(BaseModel::getId).collect(Collectors.toSet()));
                 ^
    equality constraints: Set<T#2>
    lower bounds: List<Long>,Object
  where R,A,T#1,T#2 are type-variables:
    R extends Object declared in method <R,A>collect(Collector<? super T#1,A,R>)
    A extends Object declared in method <R,A>collect(Collector<? super T#1,A,R>)
    T#1 extends Object declared in interface Stream
    T#2 extends Object declared in method <T#2>toSet()
/home/jrodriguez/Downloads/traccar/src/main/java/org/traccar/session/cache/CacheManager.java:288: error: incompatible types: bad return type in lambda expression
                            links.computeIfAbsent(Notification.class, k -> new LinkedHashSet<>()).add(object.getId());
                                                                                            ^
    cannot infer type arguments for LinkedHashSet<>
      reason: no instance(s) of type variable(s) E exist so that LinkedHashSet<E> conforms to List<Long>
  where E is a type-variable:
    E extends Object declared in class LinkedHashSet
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
6 errors

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
5 actionable tasks: 1 executed, 4 up-to-date
Anton Tananaev 3 years ago

Doesn't look like you applied the changes correctly.

I copy from the file you sent src/main/java/org/traccar/session/cache/CacheManager.java and replace it and then recompile

Is it possible that you can share the already compiled file with us?

I managed to compile it correctly.

This is the link of the compiled jar with the correction

https://www.dropbox.com/s/1aiw6pg1vjbux5o/tracker-server.jar?dl=0

the correction works perfectly

thank you very much @anton