# Mongodb/Unifi, "DSACK update: -245946829..-245946682, rcv_nxt: 4049020614" spam



## nerozero (Jan 24, 2020)

Hello,

Not sure in which thread should I post this, I will try my best here... 

After recent update (January 2nd) The Unifi module spamming messages and dmesg with following messages: (se messages under spoiler)
The source of this messages is unifi or mongodb (imho)....


```
cat /var/log/messages | grep DSACK
Jan 24 18:40:00 nz kernel: DSACK update: -76523026..-76522865, rcv_nxt: 4218444431
Jan 24 18:40:00 nz kernel: DSACK update: -76522865..-76522694, rcv_nxt: 4218444602
Jan 24 18:40:00 nz kernel: DSACK update: -76522694..-76522533, rcv_nxt: 4218444763
Jan 24 18:40:00 nz kernel: DSACK update: -76522533..-76522372, rcv_nxt: 4218444924
Jan 24 18:40:00 nz kernel: DSACK update: -76522372..-76522211, rcv_nxt: 4218445085
Jan 24 18:40:00 nz kernel: DSACK update: -76522211..-76522048, rcv_nxt: 4218445248
Jan 24 18:40:00 nz kernel: DSACK update: -76522048..-76521885, rcv_nxt: 4218445411
Jan 24 18:40:00 nz kernel: DSACK update: -1717928016..-1717927840, rcv_nxt: 2577039456
Jan 24 18:40:00 nz kernel: DSACK update: -1717927840..-1717927657, rcv_nxt: 2577039639
Jan 24 18:40:02 nz kernel: DSACK update: -245951574..-245951413, rcv_nxt: 4049015883
Jan 24 18:40:02 nz kernel: DSACK update: -1717927510..-1717927349, rcv_nxt: 2577039947
Jan 24 18:40:02 nz kernel: DSACK update: -1717927349..-1717927211, rcv_nxt: 2577040085
Jan 24 18:40:02 nz kernel: DSACK update: -1717927211..-1717927059, rcv_nxt: 2577040237
Jan 24 18:40:07 nz kernel: DSACK update: -1717926912..-1717926751, rcv_nxt: 2577040545
Jan 24 18:40:07 nz kernel: DSACK update: -245951266..-245951105, rcv_nxt: 4049016191
Jan 24 18:40:07 nz kernel: DSACK update: -1717926751..-1717926585, rcv_nxt: 2577040711
Jan 24 18:40:07 nz kernel: DSACK update: -245951105..-245950930, rcv_nxt: 4049016366
Jan 24 18:40:07 nz kernel: DSACK update: -245950930..-245950755, rcv_nxt: 4049016541
Jan 24 18:40:07 nz kernel: DSACK update: -1717926585..-1717926419, rcv_nxt: 2577040877
Jan 24 18:40:07 nz kernel: DSACK update: -245950755..-245950589, rcv_nxt: 4049016707
Jan 24 18:40:07 nz kernel: DSACK update: -245950589..-245950423, rcv_nxt: 4049016873
Jan 24 18:40:07 nz kernel: DSACK update: -245950423..-245950257, rcv_nxt: 4049017039
Jan 24 18:40:07 nz kernel: DSACK update: -245950257..-245950091, rcv_nxt: 4049017205
Jan 24 18:40:11 nz kernel: DSACK update: -245949498..-245949322, rcv_nxt: 4049017974
Jan 24 18:40:11 nz kernel: DSACK update: -245949322..-245949139, rcv_nxt: 4049018157
Jan 24 18:40:24 nz kernel: DSACK update: -245948546..-245948370, rcv_nxt: 4049018926
Jan 24 18:40:24 nz kernel: DSACK update: -245948370..-245948187, rcv_nxt: 4049019109
Jan 24 18:40:37 nz kernel: DSACK update: -245947594..-245947418, rcv_nxt: 4049019878
Jan 24 18:40:37 nz kernel: DSACK update: -245947418..-245947235, rcv_nxt: 4049020061
Jan 24 18:41:00 nz kernel: DSACK update: 1527366755..1527366814, rcv_nxt: 1527366814
Jan 24 18:41:01 nz kernel: DSACK update: 1527366876..1527366934, rcv_nxt: 1527366934
Jan 24 18:41:04 nz kernel: DSACK update: -245946924..-245946829, rcv_nxt: 4049020467
Jan 24 18:41:04 nz kernel: DSACK update: -1717926283..-1717926188, rcv_nxt: 2577041108
Jan 24 18:41:04 nz kernel: DSACK update: -245946829..-245946682, rcv_nxt: 4049020614
Jan 24 18:41:04 nz kernel: DSACK update: -1717926188..-1717926041, rcv_nxt: 2577041255
Jan 24 18:41:04 nz kernel: DSACK update: -1717925880..-1717925742, rcv_nxt: 2577041554
Jan 24 18:41:04 nz kernel: DSACK update: -1717925742..-1717925590, rcv_nxt: 2577041706
```

Is there a solution for that ?


----------



## nerozero (Jan 24, 2020)

Update.
after some research I have found this code:

```
// Line 169, file: /usr/src/sys/netinet/tcp_sack.c
if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) {
                log(LOG_DEBUG, "\nDSACK update: %d..%d, rcv_nxt: %u\n",
                rcv_start, rcv_end, tp->rcv_nxt);
        }
```

so this is probably not the issue of the port but someone forget to turn off DEBUG in FreeBSD kernel ... (I have updated it too)...
forget to describe version:
uname -a: 12.1-RELEASE-p1 GENERIC  amd64


----------



## chavez243ca (Apr 15, 2020)

having these debug messages effectively spamming /var/log/messages is a bit of a headache.


----------



## msplsh (Apr 15, 2020)

Run `freebsd-update`, get the new kernel, and then report back.  They're on -p3 now...


----------



## chavez243ca (Apr 15, 2020)

this is with 12.1-RELEASE-p3


----------



## msplsh (Apr 15, 2020)

Remove debug code not needed anymore. · freebsd/freebsd-src@e51fa01
					

Submitted by:		Richard Scheffenegger Reviewed by:		tuexen@ MFC after:		1 week Differential Revision:	https://reviews.freebsd.org/D23208




					github.com


----------



## msplsh (Apr 15, 2020)

Added here









						This patch improves the DSACK handling to conform with RFC 2883. · freebsd/freebsd-src@040eca9
					

The lowest SACK block is used when multiple Blocks would be elegible as DSACK blocks ACK blocks get reordered - while maintaining the ordering of SACK blocks not relevant in the DSACK context is ma...




					github.com
				




This does a bitwise AND to the socket option, so that means whoever opened the socket set the debug flag.  Ports issue, then.


----------



## SirDice (Apr 15, 2020)

Shouldn't this be logged with a debug level in any case? As /var/log/messages only logs info or higher (by default) it shouldn't even appear? Or am I misunderstanding  LOG_DEBUG in this context?

Edit:  Oh, wait. `kern.debug` ends up in messages too. Quick and dirty fix would be to change it to `kern.info`. You could set it until that bit of code is removed.


----------



## acheron (Apr 16, 2020)

What version of mongodb do you have?


----------



## msplsh (Apr 16, 2020)

Should be 3.6, as that's what UniFi depends on.  I downloaded the source to .17 and .14 but I couldn't find any instances of SO_DEBUG or setsockopt in the diff.


----------



## acheron (Apr 16, 2020)

I've upgraded one of my mongodb instance to 4.0 and I don't have the dsack message anymore (not sure if it's related though).


----------



## msplsh (Apr 16, 2020)

UniFi doesn't work on 4


----------

