OpenVPN Server TCP_CLIENT link local: (not bound) - tcp

I've been trying to set up an OpenVPN server on my Linux recently but I continuously get the same error every time I try to connect to my server.
My settings are like this:
proto tcp
port 443
resolv-retry infinite
nobind
user nobody
group nogroup
cipher AES-256-CBC
auth SHA256
script-security 2
up /etc/openvpn/update-systemd-resolved
down /etc/openvpn/update-systemd-resolved
down-pre
dhcp-option DOMAIN-ROUTE .
I have checked the settings on my server and local computer a million times and all of them are the same. Still don't know what I have to do about it. Thanks in advance! :*
Sat Nov 27 23:45:11 2021 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jul 19 2021
Sat Nov 27 23:45:11 2021 library versions: OpenSSL 1.1.1f 31 Mar 2020, LZO 2.10
Sat Nov 27 23:45:11 2021 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Sat Nov 27 23:45:11 2021 TCP/UDP: Preserving recently used remote address: [AF_INET]myserverip:443
Sat Nov 27 23:45:11 2021 Socket Buffers: R=[131072->131072] S=[16384->16384]
Sat Nov 27 23:45:11 2021 Attempting to establish TCP connection with [AF_INET]myserverip:443 [nonblock]
Sat Nov 27 23:45:12 2021 TCP connection established with [AF_INET]myserverip:443
Sat Nov 27 23:45:12 2021 TCP_CLIENT link local: (not bound)
Sat Nov 27 23:45:12 2021 TCP_CLIENT link remote: [AF_INET]myserverip:443
Sat Nov 27 23:45:12 2021 NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
Sat Nov 27 23:45:12 2021 Connection reset, restarting [0]
Sat Nov 27 23:45:12 2021 SIGUSR1[soft,connection-reset] received, process restarting
Sat Nov 27 23:45:12 2021 Restart pause, 5 second(s)

Related

No Database Connection: MariaDB Won't Start

When I run the command sudo /opt/bitnami/ctlscript.sh restart, my Apache server starts but MariaDB does not. Below are the logs from journalctl -xe.
Aug 16 16:29:54 ip-172-26-6-254 bitnami[7264]: ## 2022-08-16 16:29:54+00:00 ## INFO ## Starting services...
Aug 16 16:29:55 ip-172-26-6-254 bitnami[7264]: 2022-08-16T16:29:55.550Z - info: Saving configuration info to disk
Aug 16 16:29:55 ip-172-26-6-254 bitnami[7264]: 2022-08-16T16:29:55.915Z - info: Performing service start operation for php
Aug 16 16:29:56 ip-172-26-6-254 bitnami[7264]: php 16:29:56.22 INFO ==> php-fpm is already running
Aug 16 16:29:56 ip-172-26-6-254 bitnami[7264]: 2022-08-16T16:29:56.225Z - info: Performing service start operation for apache
Aug 16 16:29:56 ip-172-26-6-254 bitnami[7264]: apache 16:29:56.50 INFO ==> apache is already running
Aug 16 16:29:56 ip-172-26-6-254 bitnami[7264]: 2022-08-16T16:29:56.503Z - info: Skipping service start operation for varnish
Aug 16 16:29:56 ip-172-26-6-254 bitnami[7264]: 2022-08-16T16:29:56.503Z - info: Performing service start operation for mariadb
Aug 16 16:30:56 ip-172-26-6-254 bitnami[7264]: mariadb 16:30:56.82 ERROR ==> mariadb did not start
Aug 16 16:30:56 ip-172-26-6-254 bitnami[7264]: 2022-08-16T16:30:56.831Z - error: Unable to perform start operation Export start for mariadb failed with exit code 1
Aug 16 16:30:56 ip-172-26-6-254 bitnami[7264]: ## 2022-08-16 16:30:56+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/010_bitnami_agent_extra...
Aug 16 16:30:56 ip-172-26-6-254 bitnami[7264]: ## 2022-08-16 16:30:56+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/020_bitnami_agent...
Aug 16 16:30:56 ip-172-26-6-254 bitnami[7264]: ## 2022-08-16 16:30:56+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/030_update_welcome_file...
Aug 16 16:30:56 ip-172-26-6-254 bitnami[7264]: ## 2022-08-16 16:30:56+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/040_bitnami_credentials_file...
Aug 16 16:30:56 ip-172-26-6-254 bitnami[7264]: ## 2022-08-16 16:30:56+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/050_clean_metadata...
Aug 16 16:30:56 ip-172-26-6-254 sudo[7255]: pam_unix(sudo:session): session closed for user root
Aug 16 16:30:56 ip-172-26-6-254 systemd[1]: bitnami.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStart= process belonging to unit bitnami.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
When I try restarting just MariaDB (sudo /opt/bitnami/ctlscript.sh restart mariadb), the command hangs for about 1 minute and then I get the following (unhelpful) error:
Failed to restart mariadb: Failed to restart mariadb
I'm not sure what else to do here.

Model failed to converge (lme4)

I would like to achieve the following task. Using a linear mixed model, I would like to check whether "Month" (see dat table) has a significant effect on the "Response" variable. As for some of the tanks, data comes from different months, I included it as a random factor in my model. Please note, that sampling the same tank in different months does not change the "Response" variable. For some tank-month combinations there are multiple records, as we are included the compartment of the tank that was sampled (e.g. NW =north west).
Here the data:
print(dat)
Tank Month ID Response
1 AEW1 Jul AEW01SOBFJul2008 1.80522937
2 AEW10 Jul AEW10NWBFJul2008 2.13374401
3 AEW10 Jul AEW10NWBFJul2008 2.13374401
4 AEW11 Jun AEW11SWBFJun2008 1.65010205
5 AEW14 Jun AEW14SWBFJun2008 1.75459326
6 AEW15 Jun AEW15SOBFJun2008 2.82200903
7 AEW15 Jun AEW15SOBFJun2008 2.82200903
8 AEW18 Jul AEW18SOBFJul2008 0.39349330
9 AEW19 Jul AEW19NWBFJul2008 0.65886661
10 AEW20 Jul AEW20NWBFJul2008 1.07838018
11 AEW24 Jun AEW24NOBFJun2008 2.56677635
12 AEW27 Jul AEW27SWBFJul2008 2.64019328
13 AEW27 Jul AEW27SWBFJul2008 2.64019328
14 AEW29 Jul AEW29SOBFJul2008 2.06251217
15 AEW30 Jul AEW30NWBFJul2008 1.17010646
16 AEW31 Jun AEW31SWBFJun2008 2.25518873
17 AEW32 Jun AEW32SOBFJun2008 2.38707614
18 AEW33 Jun AEW33SOBFJun2008 2.30498448
19 AEW33 Jun AEW33SOBFJun2008 2.30498448
20 AEW36 Jul AEW36NOBFJul2008 1.92368247
21 AEW37 Jun AEW37NOBFJun2008 0.99387013
22 AEW39 Jul AEW39NOBFJul2008 1.24163732
23 AEW4 Jul AEW04SWBFJul2008 1.56327732
24 AEW42 Jun AEW42SWBFJun2008 1.26012579
25 AEW44 Jun AEW44SWBFJun2008 0.75985267
26 AEW48 Aug AEW48SOBFAug2008 1.57920494
27 AEW50 Jul AEW50NOBFJul2008 0.90052629
28 AEW8 Jul AEW08NOBFJul2008 0.00000000
29 AEW8 Jul AEW08NOBFJul2008 0.00000000
30 AEW9 Jul AEW09NOBFJul2008 0.48529647
31 HEW10 Jun HEW10SWBFJun2008 0.06412823
32 HEW10 Aug HEW10SOBFAug2008 0.06412823
33 HEW12 Jul HEW12NOBFJul2008 0.00000000
34 HEW13 Aug HEW13NWBFAug2008 2.24515850
35 HEW13 Jul HEW13SOBFJul2008 2.24515850
36 HEW13 Jul HEW13NOBFJul2008 2.24515850
37 HEW13 Jun HEW13SOBFJun2008 2.24515850
38 HEW13 Jun HEW13NWBFJun2008 2.24515850
39 HEW14 Jul HEW14SOBFJul2008 1.64783184
40 HEW18 Jun HEW18NWBFJun2008 1.32435721
41 HEW18 Jun HEW18NWBFJun2008 1.32435721
42 HEW19 Jul HEW19SWBFJul2008 1.01761003
43 HEW19 Jul HEW19SWBFJul2008 1.01761003
44 HEW22 Aug HEW22SWBFAug2008 0.63861037
45 HEW23 Jun HEW23SWBFJun2008 1.38472769
46 HEW23 Jun HEW23NWBFJun2008 1.38472769
47 HEW28 Jun HEW28NOBFJun2008 1.44377199
48 HEW3 Jun HEW03SWBFJun2008 2.19793633
49 HEW3 Jul HEW03SWBFJul2008 2.19793633
50 HEW30 Aug HEW30NWBFAug2008 0.76260579
51 HEW31 Jul HEW31SWBFJul2008 1.07879539
52 HEW35 Jun HEW35NWBFJun2008 0.86098152
53 HEW35 Jun HEW35NWBFJun2008 0.86098152
54 HEW36 Aug HEW36SOBFAug2008 0.36533352
55 HEW39 Jun HEW39SOBFJun2008 0.09283168
56 HEW4 Jun HEW04SWBFJun2008 1.89046783
57 HEW41 Aug HEW41NWBFAug2008 0.31996275
58 HEW41 Aug HEW41NWBFAug2008 0.31996275
59 HEW41 Jul HEW41NWBFJul2008 0.31996275
60 HEW41 Jul HEW41NWBFJul2008 0.31996275
61 HEW42 Jul HEW42NWBFJul2008 0.53998250
62 HEW43 Jun HEW43SWBFJun2008 1.85594061
63 HEW43 Jun HEW43SWBFJun2008 1.85594061
64 HEW44 Jun HEW44SOBFJun2008 1.79972095
65 HEW44 Jun HEW44SOBFJun2008 1.79972095
66 HEW49 Jun HEW49SWBFJun2008 1.25229249
67 HEW5 Aug HEW05SWBFAug2008 0.95559764
68 HEW50 Jun HEW50NWBFJun2008 0.42309531
69 HEW50 Jun HEW50NWBFJun2008 0.42309531
70 HEW7 Jul HEW07NWBFJul2008 0.69484213
71 HEW7 Jun HEW07NWBFJun2008 0.69484213
72 HEW8 Jul HEW08SWBFJul2008 1.15617440
73 SEW1 Aug SEW01NWBFAug2008 1.90030109
74 SEW1 Sep SEW01SWBFSep2008 1.90030109
75 SEW11 Aug SEW11NWBFAug2008 2.11940912
76 SEW12 Aug SEW12SOBFAug2008 2.29658624
77 SEW12 Jul SEW12SOBFJul2008 2.29658624
78 SEW17 Aug SEW17NOBFAug2008 1.49277937
79 SEW17 Jul SEW17NOBFJul2008 1.49277937
80 SEW17 Sep SEW17NOBFSep2008 1.49277937
81 SEW17 Aug SEW17SOBFAug2008 1.49277937
82 SEW18 Aug SEW18SOBFAug2008 1.70247509
83 SEW19 Aug SEW19SOBFAug2008 2.11617036
84 SEW20 Jul SEW20SWBFJul2008 1.87718089
85 SEW20 Jul SEW20SOBFJul2008 1.87718089
86 SEW22 Aug SEW22NOBFAug2008 0.77473833
87 SEW23 Aug SEW23NWBFAug2008 0.96183454
88 SEW23 Aug SEW23NOBFAug2008 0.96183454
89 SEW24 Jul SEW24SWBFJul2008 0.64090368
90 SEW24 Jul SEW24NWBFJul2008 0.64090368
91 SEW29 Jul SEW29SOBFJul2008 1.54699664
92 SEW29 Aug SEW29SWBFAug2008 1.54699664
93 SEW29 Aug SEW29SOBFAug2008 1.54699664
94 SEW34 Aug SEW34NWBFAug2008 1.79425003
95 SEW36 Jul SEW36SOBFJul2008 1.20337761
96 SEW4 Aug SEW04SWBFAug2008 1.59611963
97 SEW40 Sep SEW40SOBFSep2008 1.36486039
98 SEW40 Aug SEW40SWBFAug2008 1.36486039
99 SEW43 Sep SEW43SOBFSep2008 1.03169382
100 SEW44 Aug SEW44SWBFAug2008 0.79705660
101 SEW45 Jul SEW45NWBFJul2008 0.34130398
102 SEW46 Aug SEW46SOBFAug2008 0.20690386
103 SEW47 Aug SEW47SWBFAug2008 0.01564703
104 SEW47 Sep SEW47SWBFSep2008 0.01564703
105 SEW48 Aug SEW48SWBFAug2008 0.46745254
106 SEW5 Aug SEW05SWBFAug2008 0.68900435
107 SEW50 Aug SEW50NWBFAug2008 1.10731406
108 SEW7 Aug SEW07SWBFAug2008 0.08552432
109 SEW8 Jul SEW08NWBFJul2008 0.18731374
The model I generated so far is: Mod1 <- lmer(Response ~ Month + (1|Tank), data=dat)
Again, I included "Tank" because we sampled some tanks in several months but that does not change the response variable. Consequently, the response variable is fixed for each tank. Nevertheless, multiple data points originate from the same tank and I tried to account for that by including it as a random factor.
Fitting Mod1 results in the following message:
Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.306567 (tol = 0.002, component 1)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
The question is now, whether the model is overly complex and whether I can drop "Tank" as a random factor, as measuring tanks repeatedly did not have an effect on the response variable.
Thus, the question is, would a simple linear model Mod1 <- lm(Response ~ Month, data =dat) be valid? And if not, how can I solve the 2 convergence issues.
Any help is very much appreciated! :)

rrule to get the 2nd Monday, Wednesday and Friday of the month, for every month

I am trying to create a rrule for my fullcalendar event, that occur on the 2nd Monday, Wednesday and Friday of the month for every month.
Here is the rrule I have tried
RRULE:FREQ=MONTHLY;COUNT=10;INTERVAL=1;WKST=SU;BYDAY=MO,WE,FR;BYSETPOS=2
events: [{
title: 'rrule event',
rrule: {
freq: RRule.MONTHLY,
count: 10,
interval: 1,
wkst: RRule.SU,
byweekday: [RRule.MO, RRule.WE, RRule.FR],
bysetpos: [2]
},
duration: '02:00',
rendering: 'inverse-background'
}
],
This is what I get
1 Fri, 03 May 2019 12:33:53 GMT
2 Wed, 05 Jun 2019 12:33:53 GMT
3 Wed, 03 Jul 2019 12:33:53 GMT
4 Mon, 05 Aug 2019 12:33:53 GMT
5 Wed, 04 Sep 2019 12:33:53 GMT
6 Fri, 04 Oct 2019 12:33:53 GMT
7 Mon, 04 Nov 2019 12:33:53 GMT
8 Wed, 04 Dec 2019 12:33:53 GMT
9 Fri, 03 Jan 2020 12:33:53 GMT
10 Wed, 05 Feb 2020 12:33:53 GMT
What is expected is
1 Mon, 08 Apr 2019
2 Wed, 10 Apr 2019
3 Fri, 12 Apr 2019
4 Mon, 13 May 2019
5 Wed, 08 May 2019
6 Fri, 10 May 2019.........
RFC 5545, section 3.3.10. states:
Each BYDAY value can also be preceded by a positive (+n) or
negative (-n) integer. If present, this indicates the nth
occurrence of a specific day within the MONTHLY or YEARLY "RRULE".
So the rule you're looking for literally specifies the 2nd Monday (2MO), Wednesday (2WE) and Friday (2FR) of each month.
FREQ=MONTHLY;COUNT=10;BYDAY=2MO,2WE,2FR
(click to see the results)
Note that INTERVAL=1 is the default and WKST=SU is meaningless in this case, so you can just as well omit them.
Btw, your rule basically says, of all Mondays, Wednesdays and Fridays of a month, take the second instance in that month.

Force commands to run in parallel even without -j?

I know that if I put this in my Makefile
a: b c
Then run make -j2 a then it will run b and c in parallel, but what if I always want b and c to run in parallel, even if the user doesn't include -j >= 2?
In my scenario, b and c are actually daemons that never complete, so I need them to run in parallel. I don't want them to run in the background either.
It's an odd use of make, but if you want to do it with make,
given that b and c are .PHONY, you could do so like:
.PHONY: a b c
a:
$(MAKE) -j2 b c
b c:
while [ "1" ]; do echo "$#: $$(date)"; sleep 1; done
A rule:
a: b c
isn't to the purpose. It says that a depends on b (being done) and
a depends on c (being done), but you don't want that at all. You
just want a to denote the concurrent execution of the recipes for
b and c.
You get:
$ make b
while [ "1" ]; do echo "b: $(date)"; sleep 1; done
b: Wed Mar 9 18:29:55 GMT 2016
b: Wed Mar 9 18:29:56 GMT 2016
b: Wed Mar 9 18:29:57 GMT 2016
b: Wed Mar 9 18:29:58 GMT 2016
b: Wed Mar 9 18:29:59 GMT 2016
^CMakefile:7: recipe for target 'b' failed
make: *** [b] Interrupt
$ make c
while [ "1" ]; do echo "c: $(date)"; sleep 1; done
c: Wed Mar 9 18:30:38 GMT 2016
c: Wed Mar 9 18:30:39 GMT 2016
c: Wed Mar 9 18:30:40 GMT 2016
c: Wed Mar 9 18:30:41 GMT 2016
c: Wed Mar 9 18:30:42 GMT 2016
^CMakefile:7: recipe for target 'c' failed
make: *** [c] Interrupt
$ make a
make -j2 b c
make[1]: Entering directory '/home/imk/develop/so/parallel_make'
while [ "1" ]; do echo "b: $(date)"; sleep 1; done
while [ "1" ]; do echo "c: $(date)"; sleep 1; done
b: Wed Mar 9 18:31:13 GMT 2016
c: Wed Mar 9 18:31:13 GMT 2016
b: Wed Mar 9 18:31:14 GMT 2016
c: Wed Mar 9 18:31:14 GMT 2016
b: Wed Mar 9 18:31:15 GMT 2016
c: Wed Mar 9 18:31:15 GMT 2016
b: Wed Mar 9 18:31:16 GMT 2016
c: Wed Mar 9 18:31:16 GMT 2016
b: Wed Mar 9 18:31:17 GMT 2016
c: Wed Mar 9 18:31:17 GMT 2016
^CMakefile:7: recipe for target 'b' failed
make[1]: *** [b] Interrupt
Makefile:7: recipe for target 'c' failed
make[1]: *** [c] Interrupt
Makefile:4: recipe for target 'a' failed
make: *** [a] Interrupt

Appending BSON arrays in MongoDB (rmongodb)

I found this information on how to use the $push operator to add new values to an array. However, I can't seem to get this working with rmongodb
Suppose we have the following doc in the DB
_id : 7 51005201f8ab44f1690f9526
tags : 4
1 : 2 a
2 : 2 b
3 : 2 c
I'd like to add a value to the array tags. Here's what I tried:
q <- mongo.bson.from.list(list(tags="a"))
TRY 1
Here I tried using the $push operator
Code
bnew <- mongo.bson.from.list(list("$push"=list("tags"="d")))
> mongo.update(mongo=con, ns, criteria=q, objNew=bnew)
[1] FALSE
Logfile
Thu Jan 24 16:42:27 [initandlisten] MongoDB starting : pid=6260 port=27017 dbpath=\data\db\ 64-bit host=ASHB-109C-02
Thu Jan 24 16:42:27 [initandlisten] db version v2.2.2, pdfile version 4.5
Thu Jan 24 16:42:27 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267
Thu Jan 24 16:42:27 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Thu Jan 24 16:42:27 [initandlisten] options: { logpath: "log_1.txt" }
Thu Jan 24 16:42:27 [initandlisten] journal dir=/data/db/journal
Thu Jan 24 16:42:27 [initandlisten] recover : no journal files present, no recovery needed
Thu Jan 24 16:42:27 [initandlisten] waiting for connections on port 27017
Thu Jan 24 16:42:27 [websvr] admin web console waiting for connections on port 28017
Thu Jan 24 16:42:36 [initandlisten] connection accepted from 127.0.0.1:52419 #1 (1 connection now open)
Thu Jan 24 16:42:44 [conn1] __test.test Assertion failure x == _nfields src\mongo\db\jsobj.cpp 1250
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\util\stacktrace.cpp(161) mongo::printStackTrace+0x3e
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\util\assert_util.cpp(109) mongo::verifyFailed+0xdc
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\db\jsobj.cpp(1250) mongo::BSONIteratorSorted::BSONIteratorSorted+0xf3
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\db\ops\update_internal.cpp(906) mongo::ModSetState::createNewFromMods+0xa3
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\db\ops\update.cpp(370) mongo::_updateObjects+0x15a2
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\db\instance.cpp(573) mongo::receivedUpdate+0x60d
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\db\instance.cpp(437) mongo::assembleResponse+0x626
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\db\db.cpp(192) mongo::MyMessageHandler::process+0xf5
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\mongo\util\net\message_server_port.cpp(86) mongo::pms::threadRun+0x59a
Thu Jan 24 16:42:44 [conn1] mongod.exe ...\src\third_party\boost\libs\thread\src\win32\thread.cpp(180) boost::`anonymous namespace'::thread_start_function+0x21
Thu Jan 24 16:42:44 [conn1] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(314) _callthreadstartex+0x17
Thu Jan 24 16:42:44 [conn1] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(292) _threadstartex+0x7f
Thu Jan 24 16:42:44 [conn1] kernel32.dll BaseThreadInitThunk+0xd
Thu Jan 24 16:42:44 [conn1] update __test.test query: { tags: "a" } update: { $push: { tags: "d" } } nscanned:1 keyUpdates:0 exception: assertion src\mongo\db\jsobj.cpp:1250 locks(micros) w:398335 399ms
Thu Jan 24 16:42:48 CTRL_CLOSE_EVENT signal
Thu Jan 24 16:42:48 [consoleTerminate] got CTRL_CLOSE_EVENT, will terminate after current cmd ends
Thu Jan 24 16:42:48 [consoleTerminate] now exiting
Thu Jan 24 16:42:48 dbexit:
Thu Jan 24 16:42:48 [consoleTerminate] shutdown: going to close listening sockets...
Thu Jan 24 16:42:48 [consoleTerminate] closing listening socket: 496
Thu Jan 24 16:42:48 [consoleTerminate] closing listening socket: 516
Thu Jan 24 16:42:48 [consoleTerminate] shutdown: going to flush diaglog...
Thu Jan 24 16:42:48 [consoleTerminate] shutdown: going to close sockets...
Thu Jan 24 16:42:48 [consoleTerminate] shutdown: waiting for fs preallocator...
Thu Jan 24 16:42:48 [consoleTerminate] shutdown: lock for final commit...
Thu Jan 24 16:42:48 [consoleTerminate] shutdown: final commit...
Thu Jan 24 16:42:48 [conn1] end connection 127.0.0.1:52419 (0 connections now open)
Thu Jan 24 16:42:48 [consoleTerminate] shutdown: closing all files...
Thu Jan 24 16:42:48 [consoleTerminate] closeAllFiles() finished
Thu Jan 24 16:42:48 [consoleTerminate] journalCleanup...
Thu Jan 24 16:42:48 [consoleTerminate] removeJournalFiles
Thu Jan 24 16:42:48 [consoleTerminate] shutdown: removing fs lock...
Thu Jan 24 16:42:48 dbexit: really exiting now
TRY 2
Here I tried using the $addToSet operator
Code
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.start.object(buf, "$addToSet")
mongo.bson.buffer.start.object(buf, name="tags")
mongo.bson.buffer.start.array(buf, "$each")
values <- list("d", "e", "f")
for (ii in seq(along=values)) {
mongo.bson.buffer.append(
buf=buf,
name=as.character(ii),
value=values[[ii]]
)
}
mongo.bson.buffer.finish.object(buf)
mongo.bson.buffer.finish.object(buf)
mongo.bson.buffer.finish.object(buf)
bnew <- mongo.bson.from.buffer(buf)
bnew
> mongo.update(mongo=con, ns, criteria=q, objNew=bnew)
[1] FALSE
Logfile
Thu Jan 24 16:43:52 [initandlisten] MongoDB starting : pid=4184 port=27017 dbpath=\data\db\ 64-bit host=ASHB-109C-02
Thu Jan 24 16:43:52 [initandlisten] db version v2.2.2, pdfile version 4.5
Thu Jan 24 16:43:52 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267
Thu Jan 24 16:43:52 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Thu Jan 24 16:43:52 [initandlisten] options: { logpath: "log_2.txt" }
Thu Jan 24 16:43:52 [initandlisten] journal dir=/data/db/journal
Thu Jan 24 16:43:52 [initandlisten] recover : no journal files present, no recovery needed
Thu Jan 24 16:43:52 [initandlisten] waiting for connections on port 27017
Thu Jan 24 16:43:52 [websvr] admin web console waiting for connections on port 28017
Thu Jan 24 16:43:57 [initandlisten] connection accepted from 127.0.0.1:52435 #1 (1 connection now open)
Thu Jan 24 16:44:27 [conn1] __test.test Assertion failure x == _nfields src\mongo\db\jsobj.cpp 1250
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\util\stacktrace.cpp(161) mongo::printStackTrace+0x3e
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\util\assert_util.cpp(109) mongo::verifyFailed+0xdc
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\db\jsobj.cpp(1250) mongo::BSONIteratorSorted::BSONIteratorSorted+0xf3
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\db\ops\update_internal.cpp(906) mongo::ModSetState::createNewFromMods+0xa3
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\db\ops\update.cpp(370) mongo::_updateObjects+0x15a2
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\db\instance.cpp(573) mongo::receivedUpdate+0x60d
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\db\instance.cpp(437) mongo::assembleResponse+0x626
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\db\db.cpp(192) mongo::MyMessageHandler::process+0xf5
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\mongo\util\net\message_server_port.cpp(86) mongo::pms::threadRun+0x59a
Thu Jan 24 16:44:28 [conn1] mongod.exe ...\src\third_party\boost\libs\thread\src\win32\thread.cpp(180) boost::`anonymous namespace'::thread_start_function+0x21
Thu Jan 24 16:44:28 [conn1] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(314) _callthreadstartex+0x17
Thu Jan 24 16:44:28 [conn1] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(292) _threadstartex+0x7f
Thu Jan 24 16:44:28 [conn1] kernel32.dll BaseThreadInitThunk+0xd
Thu Jan 24 16:44:28 [conn1] update __test.test query: { tags: "a" } update: { $addToSet: { tags: { $each: [ "d", "e", "f" ] } } } nscanned:1 keyUpdates:0 exception: assertion src\mongo\db\jsobj.cpp:1250 locks(micros) w:390312 390ms
Thu Jan 24 16:44:33 [conn1] end connection 127.0.0.1:52435 (0 connections now open)
Thu Jan 24 16:44:37 CTRL_CLOSE_EVENT signal
Thu Jan 24 16:44:37 [consoleTerminate] got CTRL_CLOSE_EVENT, will terminate after current cmd ends
Thu Jan 24 16:44:37 [consoleTerminate] now exiting
Thu Jan 24 16:44:37 dbexit:
Thu Jan 24 16:44:37 [consoleTerminate] shutdown: going to close listening sockets...
Thu Jan 24 16:44:37 [consoleTerminate] closing listening socket: 496
Thu Jan 24 16:44:37 [consoleTerminate] closing listening socket: 500
Thu Jan 24 16:44:37 [consoleTerminate] shutdown: going to flush diaglog...
Thu Jan 24 16:44:37 [consoleTerminate] shutdown: going to close sockets...
Thu Jan 24 16:44:37 [consoleTerminate] shutdown: waiting for fs preallocator...
Thu Jan 24 16:44:37 [consoleTerminate] shutdown: lock for final commit...
Thu Jan 24 16:44:37 [consoleTerminate] shutdown: final commit...
Thu Jan 24 16:44:37 [consoleTerminate] shutdown: closing all files...
Thu Jan 24 16:44:37 [consoleTerminate] closeAllFiles() finished
Thu Jan 24 16:44:37 [consoleTerminate] journalCleanup...
Thu Jan 24 16:44:37 [consoleTerminate] removeJournalFiles
Thu Jan 24 16:44:37 [consoleTerminate] shutdown: removing fs lock...
Thu Jan 24 16:44:37 dbexit: really exiting now
What am I doing wrong here?
Additional information
For those interested: here's the code that produced the example doc
pkg <- "rmongodb"
lib <- file.path(R.home(), "library")
if (!suppressWarnings(require(pkg, lib.loc=lib, character.only=TRUE))) {
install.packages(pkg, lib=lib)
require(pkg, lib.loc=lib, character.only=TRUE)
}
# CONNECTION
db <- "__test"
ns <- paste(db, "test", sep=".")
con <- mongo.create(db=db)
# ENSURE EMPTY DB
mongo.remove(mongo=con, ns=ns)
# INSERT
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.start.array(buf, name="tags")
values <- list("a", "b", "c")
for (ii in seq(along=values)) {
mongo.bson.buffer.append(
buf=buf,
name=as.character(ii),
value=values[[ii]]
)
}
mongo.bson.buffer.finish.object(buf)
mongo.bson.buffer.finish.object(buf)
b <- mongo.bson.from.buffer(buf)
mongo.insert(mongo=con, ns=ns, b=b)
EDIT 2013-01-29
As suggested by Tad Marshall from 10gen in his comment to my bug report, I re-ran the code that inserts the document with the MongoDB server running in --objcheck mode (validates BSON structures) and voilĂ : the server won't let me insert the doc due to an assertion that fails. If I run the server without the --objcheck flag, insertion is successful (but that's probably just due to the fact that no validation takes place).
Note that I tried two different versions of putting together the array in tags as my initial code produced a doc that IMHO is not in sync with MongoDB's indexing conventions:
(Potentially) Invalid document
That's how I did it above. I noticed that I didn't make sure the array index starts with a 0. Insertion of this document will fail (see logfile below)
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.start.array(buf, name="tags")
values <- list("a", "b", "c")
for (ii in seq(along=values)) {
mongo.bson.buffer.append(
buf=buf,
name=as.character(ii),
value=values[[ii]]
)
}
mongo.bson.buffer.finish.object(buf) # finish array 'tags'
mongo.bson.buffer.finish.object(buf) # finish buffer
b <- mongo.bson.from.buffer(buf)
> b
tags : 4
1 : 2 a
2 : 2 b
3 : 2 c
Valid document
I made sure the index starts with 0, so this should definitely be a valid BSON doc. But inserting this document will fail, too (see logfile below)
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.start.array(buf, name="tags")
values <- list("a", "b", "c")
for (ii in seq(along=values)) {
mongo.bson.buffer.append(
buf=buf,
name=as.character(ii-1),
value=values[[ii]]
)
}
mongo.bson.buffer.finish.object(buf) # finish array 'tags'
mongo.bson.buffer.finish.object(buf) # finish buffer
b <- mongo.bson.from.buffer(buf)
b
mongo.insert(mongo=con, ns=ns, b=b)
> b
tags : 4
0 : 2 a
1 : 2 b
2 : 2 c
Logfile
Tue Jan 29 14:20:46 [initandlisten] MongoDB starting : pid=6440 port=27017
[...]
Tue Jan 29 14:20:59 [initandlisten] connection accepted from 127.0.0.1:62137 #1 (1 connection now open)
Tue Jan 29 14:21:03 [conn1] Assertion: 10307:Client Error: bad object in message
Tue Jan 29 14:21:04 [conn1] mongod.exe ...\src\mongo\util\stacktrace.cpp(161) mongo::printStackTrace+0x3e
Tue Jan 29 14:21:04 [conn1] mongod.exe ...\src\mongo\util\assert_util.cpp(154) mongo::msgasserted+0xc1
Tue Jan 29 14:21:04 [conn1] mongod.exe ...\src\mongo\db\dbmessage.h(205) mongo::DbMessage::nextJsObj+0x103
Tue Jan 29 14:21:04 [conn1] mongod.exe ...\src\mongo\db\instance.cpp(784) mongo::receivedInsert+0xdb
Tue Jan 29 14:21:04 [conn1] mongod.exe ...\src\mongo\db\instance.cpp(434) mongo::assembleResponse+0x607
Tue Jan 29 14:21:04 [conn1] mongod.exe ...\src\mongo\db\db.cpp(192) mongo::MyMessageHandler::process+0xf5
Tue Jan 29 14:21:04 [conn1] mongod.exe ...\src\mongo\util\net\message_server_port.cpp(86) mongo::pms::threadRun+0x59a
Tue Jan 29 14:21:04 [conn1] mongod.exe ...\src\third_party\boost\libs\thread\src\win32\thread.cpp(180) boost::`anonymous namespace'::thread_start_function+0x21
Tue Jan 29 14:21:04 [conn1] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(314) _callthreadstartex+0x17
Tue Jan 29 14:21:04 [conn1] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(292) _threadstartex+0x7f
Tue Jan 29 14:21:04 [conn1] kernel32.dll BaseThreadInitThunk+0xd
Tue Jan 29 14:21:04 [conn1] insert __test.test keyUpdates:0 exception: Client Error: bad object in message code:10307 0ms
Tue Jan 29 14:21:07 [conn1] Assertion: 10307:Client Error: bad object in message
Tue Jan 29 14:21:07 [conn1] mongod.exe ...\src\mongo\util\stacktrace.cpp(161) mongo::printStackTrace+0x3e
Tue Jan 29 14:21:07 [conn1] mongod.exe ...\src\mongo\util\assert_util.cpp(154) mongo::msgasserted+0xc1
Tue Jan 29 14:21:07 [conn1] mongod.exe ...\src\mongo\db\dbmessage.h(205) mongo::DbMessage::nextJsObj+0x103
Tue Jan 29 14:21:07 [conn1] mongod.exe ...\src\mongo\db\instance.cpp(784) mongo::receivedInsert+0xdb
Tue Jan 29 14:21:07 [conn1] mongod.exe ...\src\mongo\db\instance.cpp(434) mongo::assembleResponse+0x607
Tue Jan 29 14:21:07 [conn1] mongod.exe ...\src\mongo\db\db.cpp(192) mongo::MyMessageHandler::process+0xf5
Tue Jan 29 14:21:07 [conn1] mongod.exe ...\src\mongo\util\net\message_server_port.cpp(86) mongo::pms::threadRun+0x59a
Tue Jan 29 14:21:07 [conn1] mongod.exe ...\src\third_party\boost\libs\thread\src\win32\thread.cpp(180) boost::`anonymous namespace'::thread_start_function+0x21
Tue Jan 29 14:21:07 [conn1] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(314) _callthreadstartex+0x17
Tue Jan 29 14:21:07 [conn1] mongod.exe f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(292) _threadstartex+0x7f
Tue Jan 29 14:21:07 [conn1] kernel32.dll BaseThreadInitThunk+0xd
Tue Jan 29 14:21:07 [conn1] insert __test.test keyUpdates:0 exception: Client Error: bad object in message code:10307 0ms
Oh, I am smacking myself up now. I didn't look closely at the way you were creating your document. You have two mongo.bson.finish.object() calls when you need only one to finish off the array you started. You do not need to call it to finish a BSON. mongo.bson.from.buffer() does the necessary housekeeping. This is my fault for not reading your code closely enough. I thought it was your update failing when the initial insert of the documents is the problem. For questions here in the future, it would help if your examples were a little easier to read. For instance, this will build the document:
library('rmongodb')
m = mongo.create()
ns = '__test.test'
mongo.insert(m, ns, list(tags=c('a', 'b', 'c'))
However, you are probably pasting in real-world code so I understand where the complications come in. Everything's cool. Just beating myself up for missing this and sending you on a wild goose chase. Regards
Rappster, both of these examples worked for me on my development machine, but I am slightly out of date running a debug build of mongod 2.1.0.
Since you are crashing the server with your example code, this is something the 10gen people will want to know about. Do you mind going to https://jira.mongodb.org/secure/Dashboard.jspa and reporting this bug?
Thanks,
Gerald Lindsly

Resources